//========== void Awake() { this.showGUI = false; this.broadcastPort = 4777; InvokeRepeating("checkHost", 5f, 5f); DontDestroyOnLoad(gameObject); Initialize(); StartAsClient(); mUnitMgr = new Unit.Mgr(false); mClient = new NetworkClient(); bag = new Bag(); mClient.RegisterHandler(MsgType.Connect, onConnected); mClient.RegisterHandler(MsgType.Disconnect, onDisConnect); mClient.RegisterHandler((short)MyMsgId.Time, onTime); mClient.RegisterHandler((short)MyMsgId.Login, onLogin); mClient.RegisterHandler((short)MyMsgId.Create, onUnitCreate); mClient.RegisterHandler((short)MyMsgId.CreateBullet, onCreateBullet); mClient.RegisterHandler((short)MyMsgId.ReqPick, OnReqPick); mClient.RegisterHandler((short)MyMsgId.ItemChange, OnItemChange); //unit message begin mClient.RegisterHandler((short)MyMsgId.State, onUnitMsg); mClient.RegisterHandler((short)MyMsgId.Anim, onUnitMsg); mClient.RegisterHandler((short)MyMsgId.Attr, onUnitMsg); mClient.RegisterHandler((short)MyMsgId.Nav, onUnitMsg); mClient.RegisterHandler((short)MyMsgId.Move, onUnitMsg); mClient.RegisterHandler((short)MyMsgId.Buff, onUnitMsg); mClient.RegisterHandler((short)MyMsgId.Event, onUnitMsg); mClient.RegisterHandler((short)MyMsgId.Skill, onUnitMsg); //unit message end }
//========== void Awake() { this.showGUI = false; this.broadcastPort = 4777; DontDestroyOnLoad(gameObject); Initialize(); mUnitMgr = new Unit.Mgr(true); NetworkServer.Listen(5003); NetworkServer.RegisterHandler(MsgType.Connect, onConnected); NetworkServer.RegisterHandler(MsgType.Disconnect, onDisconnected); NetworkServer.RegisterHandler((short)MyMsgId.Time, onTime); NetworkServer.RegisterHandler((short)MyMsgId.ReqUnit, onReqUnit); NetworkServer.RegisterHandler((short)MyMsgId.ReqEnterBattle, OnReqEnterBattle); NetworkServer.RegisterHandler((short)MyMsgId.ReqCreateHero, OnReqCreateHero); NetworkServer.RegisterHandler((short)MyMsgId.ReqPick, OnReqPick); NetworkServer.RegisterHandler((short)MyMsgId.ReqBuyItem, OnReqBuyItem); //unit message begin NetworkServer.RegisterHandler((short)MyMsgId.State, onUnitMsg); NetworkServer.RegisterHandler((short)MyMsgId.Anim, onUnitMsg); NetworkServer.RegisterHandler((short)MyMsgId.Nav, onUnitMsg); NetworkServer.RegisterHandler((short)MyMsgId.Move, onUnitMsg); NetworkServer.RegisterHandler((short)MyMsgId.Skill, onUnitMsg); //unit message end }
protected override void onStart() { unitMgr = new Unit.Mgr(false); Player u = unitMgr.getUnit(0, UnitType.Player, 1002) as Player; u.setParam(bornPos, Vector3.forward); player = u; Camera.main.gameObject.AddComponent <CameraController4First>(); WindowMgr.single.GetWindow("ActMainWindow", true); EventMgr.single.PostEvent("Game.Player", player); }