foreach(string str in strArray) { ObjectInfo info = new ObjectInfo(); ObjectType type = ObjectType.Drug; string[] proArray = str.Split(','); int id = int.Parse(proArray[0]); string name = proArray[1]; string ico
消息基类为System下的EventArgs,我们所有的消息体都要继承在EventArgs。我们在CommonMessageEvent下写了多个基本消息类,如下:BoolArgs,IntArgs,StringArgs,FloatArgs,Vector3Args,TransformArgs,GameObjectArgs,在发送此等消息时可直接使用已有的消息类。 在发送消息之前,先在EventIdPool中声明消息id,如下: public enum Even...
Vector2 screenSize=newVector2(Screen.width,Screen.height);float scaleFactor=0;switch(m_ScreenMatchMode){caseScreenMatchMode.MatchWidthOrHeight:{// We take the log of the relative width and height before taking the average.// Then we transform it back in the original space.// the reason to t...
17 //是否是主路径房间 18 public bool bMainCrossRoom; 19 } 20 21 public class RoomTran 22 { 23 public int Length; 24 public int Width; 25 //长宽中心点 26 public Vector2Int CenterPos; 27 //高度位置 28 public float PosY; 29 } 30 31 public enum RoomBattleType 32 { 33 Rest, 34 ...
9 新建一个脚本“ResourcesTool”,在打开的“EnumResources”脚本上进行代码编辑,首先继承单例“Singleton”使资源工具单例化,然后设置一个公有的可泛型使用的资源加载函数,通过Switch和Enum来判断所加载的资源是哪个,最后返回加载的结果 ,具体代码及代码说明如下图 10 “ResourcesTool”脚本具体内容如下:using...
要在代码中描述基本的FSM,您可以使用包含枚举和switch语句的简单方法。 public enum PlayerControllerState { Idle, Walk, Jump } public class UnrefactoredPlayerController : MonoBehaviour { private PlayerControllerState state; private void Update() { GetInput(); switch (state) { case PlayerControllerState...
switch(eventCode) { caseEvMove: { Hashtable evTable = contentasHashtable; intturn = (int)evTable["turn"]; objectmove = evTable["move"]; this.TurnManagerListener.OnPlayerMove(sender, turn, move); break; } caseEvFinalMove: { Hashtable evTable = contentasHashtable; ...
publicenumTransitionType//创建传送类型的枚举 {SameScene, DifferentScene } [Header("Transition Info")] publicstringsceneName;//以字符串形式记录 终点场景名public TransitionType transitionType;//传送类型枚举变量,需要在Unity窗口中设置public TransitionDestination.DestinationTag destinationTag;//设置传送终点名pri...
/* in block. Used to protect objects reachable */ /* from reclaim notifiers. */ int (GC_CALLBACK *ok_disclaim_proc)(void * /*obj*/); /* The disclaim procedure is called before obj */ /* is reclaimed, but must also tolerate being */ ...
requiredstringname=3; } 2.协议解析类的生成,如下图所示,双击protoToCs.bat文件就可以把proto文件夹下的.proto协议生成c#文件并存储在generate目录下,proto和生成的cs目录更改在protoToCs文件里面 @echo off @rem 对该目录下每个*.prot文件做转换setcurdir=%cd%setprotoPath=%curdir%\proto\setgenerate=%curdir...