Skip to content

Commit

Permalink
Fix few CodeFactor inspections
Browse files Browse the repository at this point in the history
  • Loading branch information
Rian8337 committed May 1, 2024
1 parent f71d02d commit 8a13193
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/com/reco1l/framework/net/FileRequest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class FileRequest(val file: File, url: HttpUrl): WebRequest(url) {
val elapsedMilliseconds = (System.currentTimeMillis() - startTime).toFloat()

progress = totalBytes / length * 100
speedKbps = (totalBytes / elapsedMilliseconds) / 1024f * 1000f
speedKbps = totalBytes / elapsedMilliseconds / 1024f * 1000f

observer?.onDownloadUpdate(this)
}
Expand Down
6 changes: 3 additions & 3 deletions src/com/reco1l/ibancho/data/RoomMods.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.reco1l.ibancho.data

import com.reco1l.osu.multiplayer.modsToReadable
import com.reco1l.osu.multiplayer.Multiplayer
import com.reco1l.osu.multiplayer.modsToReadable
import ru.nsu.ccfit.zuev.osu.game.mods.GameMod
import ru.nsu.ccfit.zuev.osu.game.mods.GameMod.*
import java.util.*
Expand Down Expand Up @@ -73,9 +73,9 @@ data class RoomMods(
// DoubleTime and NightCore, comparing them as one.
&& (MOD_DOUBLETIME in set || MOD_NIGHTCORE in set) == (MOD_DOUBLETIME in other.set || MOD_NIGHTCORE in other.set)
// HalfTime
&& (MOD_HALFTIME in set == MOD_HALFTIME in other.set)
&& MOD_HALFTIME in set == MOD_HALFTIME in other.set
// ScoreV2
&& (MOD_SCOREV2 in set == MOD_SCOREV2 in other.set)
&& MOD_SCOREV2 in set == MOD_SCOREV2 in other.set

|| set == other.set

Expand Down
30 changes: 8 additions & 22 deletions src/com/reco1l/osu/multiplayer/RoomScene.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,13 @@ import android.app.AlertDialog
import com.reco1l.ibancho.IPlayerEventListener
import com.reco1l.ibancho.IRoomEventListener
import com.reco1l.ibancho.RoomAPI
import com.reco1l.ibancho.data.PlayerStatus
import com.reco1l.ibancho.data.PlayerStatus.MISSING_BEATMAP
import com.reco1l.ibancho.data.PlayerStatus.NOT_READY
import com.reco1l.ibancho.data.PlayerStatus.PLAYING
import com.reco1l.ibancho.data.PlayerStatus.READY
import com.reco1l.ibancho.data.Room
import com.reco1l.ibancho.data.RoomBeatmap
import com.reco1l.ibancho.data.RoomGameplaySettings
import com.reco1l.ibancho.data.RoomMods
import com.reco1l.ibancho.data.RoomPlayer
import com.reco1l.ibancho.data.RoomTeam
import com.reco1l.ibancho.data.*
import com.reco1l.ibancho.data.PlayerStatus.*
import com.reco1l.ibancho.data.RoomTeam.BLUE
import com.reco1l.ibancho.data.RoomTeam.RED
import com.reco1l.ibancho.data.TeamMode
import com.reco1l.ibancho.data.TeamMode.HEAD_TO_HEAD
import com.reco1l.ibancho.data.TeamMode.TEAM_VS_TEAM
import com.reco1l.ibancho.data.WinCondition
import com.reco1l.ibancho.data.WinCondition.ACCURACY
import com.reco1l.ibancho.data.WinCondition.MAX_COMBO
import com.reco1l.ibancho.data.WinCondition.SCORE_V1
import com.reco1l.ibancho.data.WinCondition.SCORE_V2
import com.reco1l.ibancho.data.WinCondition.*
import com.reco1l.osu.mainThread
import com.reco1l.osu.multiplayer.Multiplayer.isConnected
import com.reco1l.osu.multiplayer.Multiplayer.isRoomHost
Expand Down Expand Up @@ -55,7 +41,7 @@ import ru.nsu.ccfit.zuev.osu.online.OnlinePanel
import ru.nsu.ccfit.zuev.osu.scoring.Replay
import ru.nsu.ccfit.zuev.skins.OsuSkin
import java.text.SimpleDateFormat
import java.util.TimeZone
import java.util.*
import ru.nsu.ccfit.zuev.osu.GlobalManager.getInstance as getGlobal
import ru.nsu.ccfit.zuev.osu.LibraryManager.INSTANCE as library
import ru.nsu.ccfit.zuev.osu.ResourceManager.getInstance as getResources
Expand Down Expand Up @@ -423,7 +409,7 @@ object RoomScene : Scene(), IRoomEventListener, IPlayerEventListener
layoutMods?.baseApply(it)
it.setPosition(backButton!!.x + backButton!!.width, Config.getRES_HEIGHT() - it.heightScaled)
}
else it.setPosition(backButton!!.x + backButton!!.width, (Config.getRES_HEIGHT() - 90f))
else it.setPosition(backButton!!.x + backButton!!.width, Config.getRES_HEIGHT() - 90f)
}

// Difficulty switcher
Expand All @@ -447,8 +433,8 @@ object RoomScene : Scene(), IRoomEventListener, IPlayerEventListener
beatmapInfoRectangle?.isVisible =
getGlobal().selectedTrack != null &&
!event.isActionUp &&
event.x in it.x..(it.x + it.width) &&
event.y in it.y..(it.y + it.height)
event.x in it.x..it.x + it.width &&
event.y in it.y..it.y + it.height
}

return super.onSceneTouchEvent(event)
Expand All @@ -468,7 +454,7 @@ object RoomScene : Scene(), IRoomEventListener, IPlayerEventListener
val texture = if (path != null && !Config.isSafeBeatmapBg())
getResources().loadBackground(path) else getResources().getTexture("menu-background")

val height = texture.height * (Config.getRES_WIDTH() / texture.width.toFloat())
val height = texture.height * Config.getRES_WIDTH() / texture.width.toFloat()
val width = Config.getRES_WIDTH().toFloat()

background = SpriteBackground(Sprite(0f, (Config.getRES_HEIGHT() - height) / 2f, width, height, texture))
Expand Down
2 changes: 1 addition & 1 deletion src/com/reco1l/osu/ui/StatisticSelector.kt
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class StatisticSelector(stats: Array<StatisticV2>?) : ScrollableList(), ITouchAr
}
}

override fun contains(pX: Float, pY: Float): Boolean = pX in (570f .. 570f + 140f)
override fun contains(pX: Float, pY: Float): Boolean = pX in 570f .. 570f + 140f

override fun onAreaTouched(event: TouchEvent?, x: Float, y: Float) = super.onSceneTouchEvent(event)
}

0 comments on commit 8a13193

Please sign in to comment.