fix: 🐛 change Environment.TickCount64 to Environment.TickCount
tags/v0.1.0
| @@ -19,8 +19,8 @@ namespace GameClass.GameObj | |||
| private readonly Gadget[] propInChest = new Gadget[GameData.maxNumOfPropInChest] { new NullProp(), new NullProp() }; | |||
| public Gadget[] PropInChest => propInChest; | |||
| private int openStartTime = 0; | |||
| public int OpenStartTime => openStartTime; | |||
| private long openStartTime = 0; | |||
| public long OpenStartTime => openStartTime; | |||
| private Character? whoOpen = null; | |||
| public Character? WhoOpen => whoOpen; | |||
| public bool Open(Character character) | |||
| @@ -28,7 +28,7 @@ namespace GameClass.GameObj | |||
| lock (GameObjReaderWriterLock) | |||
| { | |||
| if (whoOpen != null) return false; | |||
| openStartTime = Environment.TickCount; | |||
| openStartTime = Environment.TickCount64; | |||
| whoOpen = character; | |||
| } | |||
| return true; | |||
| @@ -70,8 +70,8 @@ namespace GameClass.GameObj | |||
| } | |||
| } | |||
| private int openStartTime = 0; | |||
| public int OpenStartTime | |||
| private long openStartTime = 0; | |||
| public long OpenStartTime | |||
| { | |||
| get | |||
| { | |||
| @@ -86,7 +86,7 @@ namespace GameClass.GameObj | |||
| { | |||
| if (isOpen) return false; | |||
| if (whoLockOrOpen != null) return false; | |||
| openStartTime = Environment.TickCount; | |||
| openStartTime = Environment.TickCount64; | |||
| whoLockOrOpen = character; | |||
| return true; | |||
| } | |||
| @@ -97,7 +97,7 @@ namespace GameClass.GameObj | |||
| { | |||
| if (whoLockOrOpen != null) | |||
| { | |||
| if ((Environment.TickCount - openStartTime) >= GameData.degreeOfLockingOrOpeningTheDoor / whoLockOrOpen.SpeedOfOpeningOrLocking) | |||
| if ((Environment.TickCount64 - openStartTime) >= GameData.degreeOfLockingOrOpeningTheDoor / whoLockOrOpen.SpeedOfOpeningOrLocking) | |||
| isOpen = true; | |||
| whoLockOrOpen = null; | |||
| } | |||
| @@ -39,8 +39,8 @@ namespace GameClass.GameObj | |||
| } | |||
| } | |||
| private int openStartTime = 0; | |||
| public int OpenStartTime | |||
| private long openStartTime = 0; | |||
| public long OpenStartTime | |||
| { | |||
| get | |||
| { | |||
| @@ -53,7 +53,7 @@ namespace GameClass.GameObj | |||
| lock (gameObjLock) | |||
| { | |||
| if (!powerSupply || openStartTime > 0) return false; | |||
| openStartTime = Environment.TickCount; | |||
| openStartTime = Environment.TickCount64; | |||
| return true; | |||
| } | |||
| } | |||
| @@ -62,14 +62,14 @@ namespace GameClass.GameObj | |||
| { | |||
| lock (gameObjLock) | |||
| { | |||
| if (Environment.TickCount - openStartTime + openDegree >= GameData.degreeOfOpenedDoorway) | |||
| if (Environment.TickCount64 - openStartTime + openDegree >= GameData.degreeOfOpenedDoorway) | |||
| { | |||
| openDegree = GameData.degreeOfOpenedDoorway; | |||
| return true; | |||
| } | |||
| else | |||
| { | |||
| openDegree = Environment.TickCount - openStartTime + openDegree; | |||
| openDegree = (int)(Environment.TickCount64 - openStartTime) + openDegree; | |||
| openStartTime = 0; | |||
| return false; | |||
| } | |||
| @@ -12,8 +12,8 @@ namespace GameClass.GameObj | |||
| public class GameTimer : ITimer | |||
| { | |||
| private int startTime; | |||
| public int nowTime() => Environment.TickCount - startTime; | |||
| private long startTime; | |||
| public int nowTime() => (int)(Environment.TickCount64 - startTime); | |||
| private bool isGaming = false; | |||
| public bool IsGaming | |||
| @@ -35,7 +35,7 @@ namespace GameClass.GameObj | |||
| if (isGaming) | |||
| return false; | |||
| isGaming = true; | |||
| startTime = Environment.TickCount; | |||
| startTime = Environment.TickCount64; | |||
| } | |||
| Thread.Sleep(timeInMilliseconds); | |||
| isGaming = false; | |||
| @@ -30,7 +30,7 @@ namespace Gaming | |||
| }, | |||
| EndMove: obj => | |||
| { | |||
| Debugger.Output(obj, " end move at " + obj.Position.ToString() + " At time: " + Environment.TickCount); | |||
| Debugger.Output(obj, " end move at " + obj.Position.ToString() + " At time: " + Environment.TickCount64); | |||
| if (obj.CanMove && ((Bullet)obj).TypeOfBullet != BulletType.JumpyDumpty) | |||
| BulletBomb((Bullet)obj, null); | |||
| obj.ReSetCanMove(false); | |||
| @@ -162,7 +162,7 @@ namespace Gaming | |||
| { | |||
| Character? whoAttacked = gameMap.FindPlayerInPlayerID(AttackID); | |||
| if (whoAttacked == null || whoAttacked.NoHp()) | |||
| return false; | |||
| return false; | |||
| ActiveSkill activeSkill = player.FindActiveSkill(ActiveSkillType.SparksNSplash); | |||
| return ActiveSkillEffect(activeSkill, player, () => | |||
| @@ -55,7 +55,7 @@ namespace Gaming // 被动技能开局时就释放,持续到游戏结束 | |||
| } | |||
| public void Lucky(Character player) | |||
| { | |||
| player.PropInventory[0] = PropFactory.GetConsumables((PropType)((4 * Environment.TickCount) % 5 + 4), new XY(0, 0)); | |||
| player.PropInventory[0] = PropFactory.GetConsumables((PropType)((4 * Environment.TickCount64) % 5 + 4), new XY(0, 0)); | |||
| } | |||
| } | |||
| } | |||
| @@ -4,7 +4,7 @@ namespace Preparation.Interface | |||
| { | |||
| public interface IDoorway : IGameObj | |||
| { | |||
| public int OpenStartTime { get; } | |||
| public long OpenStartTime { get; } | |||
| public int OpenDegree { get; } | |||
| public bool StopOpenning(); | |||
| public bool TryToOpen(); | |||
| @@ -30,22 +30,22 @@ namespace Preparation.Interface | |||
| private readonly object skillLock = new(); | |||
| public object SkillLock => skillLock; | |||
| private int openStartTime = 0; | |||
| public int OpenStartTime | |||
| private long startTime = 0; | |||
| public long StartTime | |||
| { | |||
| get | |||
| { | |||
| lock (skillLock) | |||
| return openStartTime; | |||
| return startTime; | |||
| } | |||
| } | |||
| public bool StartSkill() | |||
| { | |||
| lock (skillLock) | |||
| { | |||
| if (Environment.TickCount - openStartTime >= SkillCD) | |||
| if (Environment.TickCount64 - startTime >= SkillCD) | |||
| { | |||
| openStartTime = Environment.TickCount; | |||
| startTime = Environment.TickCount64; | |||
| return true; | |||
| } | |||
| } | |||
| @@ -8,7 +8,7 @@ namespace Server | |||
| public static class CopyInfo | |||
| { | |||
| public static MessageOfObj? Auto(GameObj gameObj, int time) | |||
| public static MessageOfObj? Auto(GameObj gameObj, long time) | |||
| { | |||
| switch (gameObj.Type) | |||
| { | |||
| @@ -49,7 +49,7 @@ namespace Server | |||
| return objMsg; | |||
| } | |||
| private static MessageOfObj? Student(Student player, int time) | |||
| private static MessageOfObj? Student(Student player, long time) | |||
| { | |||
| if (player.IsGhost()) return null; | |||
| MessageOfObj msg = new() | |||
| @@ -82,7 +82,7 @@ namespace Server | |||
| foreach (var keyValue in player.ActiveSkillDictionary) | |||
| { | |||
| int progress = (keyValue.Value.OpenStartTime - time) + keyValue.Value.SkillCD; | |||
| int progress = (int)((keyValue.Value.StartTime - time) + keyValue.Value.SkillCD); | |||
| msg.StudentMessage.TimeUntilSkillAvailable.Add(progress < 0 ? 0 : progress); | |||
| } | |||
| for (int i = 0; i < GameData.maxNumOfSkill - player.ActiveSkillDictionary.Count; ++i) | |||
| @@ -100,7 +100,7 @@ namespace Server | |||
| return msg; | |||
| } | |||
| private static MessageOfObj? Tricker(Character player, int time) | |||
| private static MessageOfObj? Tricker(Character player, long time) | |||
| { | |||
| if (!player.IsGhost()) return null; | |||
| MessageOfObj msg = new() | |||
| @@ -126,7 +126,7 @@ namespace Server | |||
| }; | |||
| foreach (var keyValue in player.ActiveSkillDictionary) | |||
| { | |||
| int progress = keyValue.Value.SkillCD + (keyValue.Value.OpenStartTime - time); | |||
| int progress = (int)(keyValue.Value.SkillCD + (keyValue.Value.StartTime - time)); | |||
| msg.TrickerMessage.TimeUntilSkillAvailable.Add(progress < 0 ? 0 : progress); | |||
| } | |||
| for (int i = 0; i < GameData.maxNumOfSkill - player.ActiveSkillDictionary.Count; ++i) | |||
| @@ -225,7 +225,7 @@ namespace Server | |||
| }; | |||
| return msg; | |||
| } | |||
| private static MessageOfObj Gate(Doorway doorway, int time) | |||
| private static MessageOfObj Gate(Doorway doorway, long time) | |||
| { | |||
| MessageOfObj msg = new() | |||
| { | |||
| @@ -235,7 +235,7 @@ namespace Server | |||
| Y = doorway.Position.y | |||
| } | |||
| }; | |||
| int progress = ((doorway.OpenStartTime > 0) ? (time - doorway.OpenStartTime) : 0) + doorway.OpenDegree; | |||
| int progress = ((doorway.OpenStartTime > 0) ? ((int)(time - doorway.OpenStartTime)) : 0) + doorway.OpenDegree; | |||
| msg.GateMessage.Progress = (progress > GameData.degreeOfOpenedDoorway) ? GameData.degreeOfOpenedDoorway : progress; | |||
| return msg; | |||
| } | |||
| @@ -267,7 +267,7 @@ namespace Server | |||
| }; | |||
| return msg; | |||
| } | |||
| private static MessageOfObj Chest(Chest chest, int time) | |||
| private static MessageOfObj Chest(Chest chest, long time) | |||
| { | |||
| MessageOfObj msg = new() | |||
| { | |||
| @@ -277,7 +277,7 @@ namespace Server | |||
| Y = chest.Position.y | |||
| } | |||
| }; | |||
| int progress = (chest.WhoOpen != null) ? ((time - chest.OpenStartTime) * chest.WhoOpen.SpeedOfOpenChest) : 0; | |||
| int progress = (chest.WhoOpen != null) ? (((int)(time - chest.OpenStartTime)) * chest.WhoOpen.SpeedOfOpenChest) : 0; | |||
| msg.ChestMessage.Progress = (progress > GameData.degreeOfOpenedChest) ? GameData.degreeOfOpenedChest : progress; | |||
| return msg; | |||
| } | |||
| @@ -133,7 +133,7 @@ namespace Server | |||
| currentGameInfo.ObjMessage.Add(currentMapMsg); | |||
| IsSpectatorJoin = false; | |||
| } | |||
| int time = Environment.TickCount; | |||
| long time = Environment.TickCount64; | |||
| foreach (GameObj gameObj in gameObjList) | |||
| { | |||
| MessageOfObj? msg = CopyInfo.Auto(gameObj, time); | |||