| @@ -6,7 +6,7 @@ v1.3 | |||||
| - 有任何问题都可以在选手群中提出建议和讨论 | - 有任何问题都可以在选手群中提出建议和讨论 | ||||
| ## 游戏接口 | ## 游戏接口 | ||||
| 删除structures.h中Player的属性place | |||||
| - 删除structures.h中Player的属性place | |||||
| ## 游戏规则 | ## 游戏规则 | ||||
| @@ -3,7 +3,7 @@ | |||||
| # 说明 | # 说明 | ||||
| - 只说明对于选手较为重要的修改 | - 只说明对于选手较为重要的修改 | ||||
| # 5.6更新的更改 | |||||
| # 5月6日更新 | |||||
| - docs:添加了 游戏机制与平衡性调整更新草案.pdf | - docs:添加了 游戏机制与平衡性调整更新草案.pdf | ||||
| - docs:添加了 版本更新说明.pdf | - docs:添加了 版本更新说明.pdf | ||||
| - docs&hotfix: 修正了GameRules.pdf中学生翻窗速度的错误 | - docs&hotfix: 修正了GameRules.pdf中学生翻窗速度的错误 | ||||
| @@ -9,6 +9,8 @@ namespace GameClass.GameObj | |||||
| /// </summary> | /// </summary> | ||||
| public abstract class GameObj : IGameObj | public abstract class GameObj : IGameObj | ||||
| { | { | ||||
| private ReaderWriterLockSlim gameObjReaderWriterLock = new(); | |||||
| public ReaderWriterLockSlim GameObjReaderWriterLock => gameObjReaderWriterLock; | |||||
| protected readonly object gameObjLock = new(); | protected readonly object gameObjLock = new(); | ||||
| public object GameLock => gameObjLock; | public object GameLock => gameObjLock; | ||||
| @@ -1,5 +1,4 @@ | |||||
| using Preparation.Utility; | using Preparation.Utility; | ||||
| using System.Collections.Generic; | |||||
| namespace GameClass.GameObj | namespace GameClass.GameObj | ||||
| { | { | ||||
| @@ -16,7 +15,7 @@ namespace GameClass.GameObj | |||||
| public override bool IsRigid => true; | public override bool IsRigid => true; | ||||
| public override ShapeType Shape => ShapeType.Square; | public override ShapeType Shape => ShapeType.Square; | ||||
| private Prop[] propInChest = new Prop[GameData.maxNumOfPropInChest] { new NullProp(), new NullProp() }; | |||||
| private readonly Prop[] propInChest = new Prop[GameData.maxNumOfPropInChest] { new NullProp(), new NullProp() }; | |||||
| public Prop[] PropInChest => propInChest; | public Prop[] PropInChest => propInChest; | ||||
| private int openStartTime = 0; | private int openStartTime = 0; | ||||
| @@ -25,7 +24,7 @@ namespace GameClass.GameObj | |||||
| public Character? WhoOpen => whoOpen; | public Character? WhoOpen => whoOpen; | ||||
| public void Open(int startTime, Character character) | public void Open(int startTime, Character character) | ||||
| { | { | ||||
| lock (gameObjLock) | |||||
| lock (GameObjReaderWriterLock) | |||||
| { | { | ||||
| openStartTime = startTime; | openStartTime = startTime; | ||||
| whoOpen = character; | whoOpen = character; | ||||
| @@ -33,7 +32,7 @@ namespace GameClass.GameObj | |||||
| } | } | ||||
| public void StopOpen() | public void StopOpen() | ||||
| { | { | ||||
| lock (gameObjLock) | |||||
| lock (GameObjReaderWriterLock) | |||||
| { | { | ||||
| openStartTime = 0; | openStartTime = 0; | ||||
| whoOpen = null; | whoOpen = null; | ||||
| @@ -8,7 +8,6 @@ namespace GameClass.GameObj | |||||
| { | { | ||||
| public partial class Map : IMap | public partial class Map : IMap | ||||
| { | { | ||||
| private readonly Dictionary<uint, XY> birthPointList; // 出生点列表 | private readonly Dictionary<uint, XY> birthPointList; // 出生点列表 | ||||
| public Dictionary<uint, XY> BirthPointList => birthPointList; | public Dictionary<uint, XY> BirthPointList => birthPointList; | ||||
| @@ -1,17 +1,15 @@ | |||||
| using Preparation.Interface; | using Preparation.Interface; | ||||
| using Preparation.Utility; | using Preparation.Utility; | ||||
| using Protobuf; | |||||
| using System.Threading; | using System.Threading; | ||||
| namespace GameClass.GameObj | namespace GameClass.GameObj | ||||
| { | { | ||||
| /// <summary> | |||||
| /// 一切游戏元素的总基类,与THUAI4不同,继承IMoveable接口(出于一切物体其实都是可运动的指导思想)——LHR | |||||
| /// </summary> | |||||
| public abstract class Moveable : GameObj, IMoveable | public abstract class Moveable : GameObj, IMoveable | ||||
| { | { | ||||
| protected readonly object moveObjLock = new(); | protected readonly object moveObjLock = new(); | ||||
| public object MoveLock => moveObjLock; | public object MoveLock => moveObjLock; | ||||
| private ReaderWriterLockSlim moveReaderWriterLock = new(); | |||||
| public ReaderWriterLockSlim MoveReaderWriterLock => moveReaderWriterLock; | |||||
| public override XY Position | public override XY Position | ||||
| { | { | ||||
| @@ -60,7 +58,7 @@ namespace GameClass.GameObj | |||||
| return moveVec * moveVec; | return moveVec * moveVec; | ||||
| } | } | ||||
| public void ReSetPos(XY position) | |||||
| public void ReSetPos(XY position) | |||||
| { | { | ||||
| lock (moveObjLock) | lock (moveObjLock) | ||||
| { | { | ||||
| @@ -72,12 +70,12 @@ namespace GameClass.GameObj | |||||
| { | { | ||||
| get | get | ||||
| { | { | ||||
| lock (gameObjLock) | |||||
| lock (moveReaderWriterLock) | |||||
| return canMove; | return canMove; | ||||
| } | } | ||||
| set | set | ||||
| { | { | ||||
| lock (gameObjLock) | |||||
| lock (moveReaderWriterLock) | |||||
| { | { | ||||
| canMove = value; | canMove = value; | ||||
| } | } | ||||
| @@ -89,12 +87,12 @@ namespace GameClass.GameObj | |||||
| { | { | ||||
| get | get | ||||
| { | { | ||||
| lock (gameObjLock) | |||||
| lock (moveReaderWriterLock) | |||||
| return isResetting; | return isResetting; | ||||
| } | } | ||||
| set | set | ||||
| { | { | ||||
| lock (gameObjLock) | |||||
| lock (moveReaderWriterLock) | |||||
| { | { | ||||
| isResetting = value; | isResetting = value; | ||||
| } | } | ||||
| @@ -111,12 +109,12 @@ namespace GameClass.GameObj | |||||
| { | { | ||||
| get | get | ||||
| { | { | ||||
| lock (gameObjLock) | |||||
| lock (moveReaderWriterLock) | |||||
| return moveSpeed; | return moveSpeed; | ||||
| } | } | ||||
| set | set | ||||
| { | { | ||||
| lock (gameObjLock) | |||||
| lock (moveReaderWriterLock) | |||||
| { | { | ||||
| moveSpeed = value; | moveSpeed = value; | ||||
| } | } | ||||
| @@ -1,5 +1,7 @@ | |||||
| using Preparation.Interface; | |||||
| using Google.Protobuf.WellKnownTypes; | |||||
| using Preparation.Interface; | |||||
| using Preparation.Utility; | using Preparation.Utility; | ||||
| using System.Threading; | |||||
| namespace GameClass.GameObj | namespace GameClass.GameObj | ||||
| { | { | ||||
| @@ -8,13 +10,21 @@ namespace GameClass.GameObj | |||||
| /// </summary> | /// </summary> | ||||
| public abstract class ObjOfCharacter : Moveable, IObjOfCharacter | public abstract class ObjOfCharacter : Moveable, IObjOfCharacter | ||||
| { | { | ||||
| private ReaderWriterLockSlim objOfCharacterReaderWriterLock = new(); | |||||
| public ReaderWriterLockSlim ObjOfCharacterReaderWriterLock => objOfCharacterReaderWriterLock; | |||||
| private ICharacter? parent = null; // 主人 | private ICharacter? parent = null; // 主人 | ||||
| public ICharacter? Parent | public ICharacter? Parent | ||||
| { | { | ||||
| get => parent; | |||||
| get | |||||
| { | |||||
| lock (objOfCharacterReaderWriterLock) | |||||
| { | |||||
| return parent; | |||||
| } | |||||
| } | |||||
| set | set | ||||
| { | { | ||||
| lock (gameObjLock) | |||||
| lock (objOfCharacterReaderWriterLock) | |||||
| { | { | ||||
| parent = value; | parent = value; | ||||
| } | } | ||||
| @@ -1,10 +1,5 @@ | |||||
| using Preparation.Utility; | using Preparation.Utility; | ||||
| using System; | using System; | ||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using System.Threading.Tasks; | |||||
| namespace GameClass.GameObj | namespace GameClass.GameObj | ||||
| { | { | ||||
| // 为方便界面组做道具拾起特效,现引入“被捡起的道具”,在每帧发送给界面组 | // 为方便界面组做道具拾起特效,现引入“被捡起的道具”,在每帧发送给界面组 | ||||
| @@ -13,11 +8,11 @@ namespace GameClass.GameObj | |||||
| public override ShapeType Shape => ShapeType.Circle; | public override ShapeType Shape => ShapeType.Circle; | ||||
| public override bool IsRigid => false; | public override bool IsRigid => false; | ||||
| public long MappingID { get; } | public long MappingID { get; } | ||||
| public Prop PropHasPicked; | |||||
| public readonly Prop propHasPicked; | |||||
| public PickedProp(Prop prop) : | public PickedProp(Prop prop) : | ||||
| base(prop.Position, prop.Radius, GameObjType.PickedProp) | base(prop.Position, prop.Radius, GameObjType.PickedProp) | ||||
| { | { | ||||
| this.PropHasPicked = prop; | |||||
| this.propHasPicked = prop; | |||||
| this.MappingID = prop.ID; | this.MappingID = prop.ID; | ||||
| } | } | ||||
| } | } | ||||
| @@ -1,6 +1,5 @@ | |||||
| using Preparation.Interface; | using Preparation.Interface; | ||||
| using Preparation.Utility; | using Preparation.Utility; | ||||
| using System.Threading; | |||||
| namespace GameClass.GameObj | namespace GameClass.GameObj | ||||
| { | { | ||||
| @@ -268,6 +268,7 @@ namespace Server | |||||
| Y = chest.Position.y | Y = chest.Position.y | ||||
| } | } | ||||
| }; | }; | ||||
| Debugger.Output(chest, chest.OpenStartTime.ToString()); | |||||
| int progress = (chest.WhoOpen != null) ? ((time - chest.OpenStartTime) * chest.WhoOpen.SpeedOfOpenChest) : 0; | int progress = (chest.WhoOpen != null) ? ((time - chest.OpenStartTime) * chest.WhoOpen.SpeedOfOpenChest) : 0; | ||||
| msg.ChestMessage.Progress = (progress > GameData.degreeOfOpenedChest) ? GameData.degreeOfOpenedChest : progress; | msg.ChestMessage.Progress = (progress > GameData.degreeOfOpenedChest) ? GameData.degreeOfOpenedChest : progress; | ||||
| return msg; | return msg; | ||||