public void Init() { NetworkMgr.InitNetwork(); UIMgr.Init(); MainCoroutine.InitMainCoroutine(); //初始化Coroutine mCurStage = cBaseStage.eSTAGE.eStage_Login; //mStages = new cBaseStage[(int)cBaseStage.eSTAGE.eStage_Max]; mStages[(int)cBaseStage.eSTAGE.eStage_Login] = new cLoginStage(); //mStages[(int)cBaseStage.eSTAGE.eStage_Select] = new cSelectStage(); mStages[(int)cBaseStage.eSTAGE.eStage_Lobby] = new cLobbyStage(); mStages[(int)cBaseStage.eSTAGE.eStage_Room] = new cRoomStage(); mStages[(int)cBaseStage.eSTAGE.eStage_Game] = new cGameStage(); for (int i = 0; i < (int)cBaseStage.eSTAGE.eStage_Max; ++i) { mStages[i].Init(this); } /// stage open mStages[(int)mCurStage].InitStage(); mStages[(int)mCurStage].Open(); CommonLogicData.RegisteredUnityLogic(new UnityLogic()); }
private void ServerChecker_DoWork(object sender, DoWorkEventArgs e) { try { NetworkMgr nMgr = new NetworkMgr(); if (nMgr.IsServerConnectionUseable("35.220.152.156")) { App.Current.Dispatcher.Invoke(() => { root_border.Background = new SolidColorBrush(Color.FromRgb(103, 58, 183)); connetion_info_label.Content = "연결됨"; }); } else { App.Current.Dispatcher.Invoke(() => { root_border.Background = new SolidColorBrush(Color.FromRgb(230, 52, 52)); connetion_info_label.Content = "접속 불가"; }); } } catch (Exception) { } }
static int AddHttpParam(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 3) { NetworkMgr obj = (NetworkMgr)ToLua.CheckObject <NetworkMgr>(L, 1); string arg0 = ToLua.CheckString(L, 2); string arg1 = ToLua.CheckString(L, 3); obj.AddHttpParam(arg0, arg1); return(0); } else if (count == 4) { NetworkMgr obj = (NetworkMgr)ToLua.CheckObject <NetworkMgr>(L, 1); string arg0 = ToLua.CheckString(L, 2); string arg1 = ToLua.CheckString(L, 3); bool arg2 = LuaDLL.luaL_checkboolean(L, 4); obj.AddHttpParam(arg0, arg1, arg2); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: NetworkMgr.AddHttpParam")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
private void GameMgrPlayerWithOthers(Message msg) { GameMgrRouter.PlayWithOthersResponse response = NetworkMgr.ParseCallback <GameMgrRouter.PlayWithOthersResponse>(msg); if (response.ret == 0) { if (response.mode == 1) // 开始匹配成功 { if (MemeryCacheMgr.Instance.Get(DTSKeys.MATCHING) is true) { return; } MemeryCacheMgr.Instance.Set(DTSKeys.MATCHING, true); btnBeginComputerGame.gameObject.SetActive(false); btnBeginMatching.gameObject.SetActive(false); btnCancelMatching.gameObject.SetActive(true); MonoMgr.Instance.StartDelayEventMultiTimes(1000, (int)matching_time, () => { // 发起 matching_time 次查询,每次间隔 1000 ms if (MemeryCacheMgr.Instance.Get(DTSKeys.MATCHING) is false) { return; } GameMgrRouter.QueryMatchingResultRequestCall(2, userID); }); } else if (response.mode == 2) // 取消匹配成功 { } } }
private void GameMgrPlayerAloneCallback(Message msg) { GameMgrRouter.PlayAloneResponse response = NetworkMgr.ParseCallback <GameMgrRouter.PlayAloneResponse>(msg); if (response.ret == 0) { BeginGameAndChangeScene(response.room_id); } }
static int Update(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 1); NetworkMgr obj = (NetworkMgr)LuaScriptMgr.GetUnityObjectSelf(L, 1, "NetworkMgr"); obj.Update(); return(0); }
public static NetworkComponent ListenTcp(NetworkMgr networkMgr, params Option[] options) { TcpServer tcpServer = new TcpServer(networkMgr, options); networkMap[tcpServer.Name()] = tcpServer; tcpServer.Start(); return(tcpServer); }
private Transform pre_InventoryGrid; //物品项按钮预制 void Awake() { Debug.Log("PanelInventory Awake"); networkMgr = Singleton.GetInstance("NetworkMgr") as NetworkMgr; PanelInit(); }
public static NetworkMgr getInstance() { if (_instance == null) { _instance = new NetworkMgr(); } return(_instance); }
public static NetworkComponent ConnectTcp(NetworkMgr networkMgr, params Option[] options) { TcpClient tcpClient = new TcpClient(networkMgr, options); networkMap[tcpClient.Name()] = tcpClient; tcpClient.Start(); return(tcpClient); }
static int OnConnect(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); NetworkMgr obj = (NetworkMgr)LuaScriptMgr.GetUnityObjectSelf(L, 1, "NetworkMgr"); StateObj arg0 = (StateObj)LuaScriptMgr.GetNetObject(L, 2, typeof(StateObj)); obj.OnConnect(arg0); return(0); }
public void OnClickOk(GameObject go) { //GameMsg_C2S_CreateRole msg = new GameMsg_C2S_CreateRole(); //NetworkMgr.SendMsg(msg); NetworkMgr.DoMessage(GameMsgType.MSG_S2C_CreateRoomSuc); UICoroutine.uiCoroutine.StartCoroutine(SwitchingControl.ShowSwitching(true, 110)); }
public void Process() { //mResourceManager.Process(); //mCameraManager.Process(); cStageManager.Instance.Process(); NetworkMgr.ProcessNetwork(); }
protected override void OnCleanUp() { FlowMgr.RemoveConduitUpdater(this.OnConduitUpdate); NetworkMgr.RemoveFromNetworks(this.OutputCell2, this.OutputItem2, true); //if (this.partitionerEntry.IsValid() && (GameScenePartitioner.Instance != null)) // GameScenePartitioner.Instance.Free(ref this.partitionerEntry); base.OnCleanUp(); }
void OnApplicationQuit() { ////游戏退出,处理线程终止和一些必要的clear if (sock != null) { Debug.Log("Application quit ,clean socket resource"); sock.CloseSocket(true); } _instance = null; }
public TcpConn(Socket s, NetworkMgr mgr) { this.agentID = AgentID.Gen(); tcpSocket = s; networkMgr = mgr; writeEventArg.Completed += new EventHandler <SocketAsyncEventArgs>(DoEventComplete); readEventArg.Completed += new EventHandler <SocketAsyncEventArgs>(DoEventComplete); }
void Awake() { if (instance == null) { instance = this; Init(); } else { UITools.logError("more NetWorkMgr in Game"); } }
public TcpClient(NetworkMgr networkMgr, params Option[] opts) : base(new Socket(SocketType.Stream, ProtocolType.Tcp), networkMgr) { try { foreach (var x in opts) { x.Do(this); } } catch (Exception ex) { sLog.Debug("tcp_server", "init tcp server error {1}", ex.Message); } }
private void InitInstance() { if (Instance == null) { Instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
protected override void OnSpawn() { try { base.OnSpawn(); Validate(); InputCell = this.Building.GetUtilityInputCell(); OutputCell1 = this.Building.GetUtilityOutputCell(); OutputCell2 = Grid.OffsetCell(Grid.PosToCell(transform.GetPosition()), this.Building.GetRotatedOffset(OutputPort2Info.offset)); OutputItem2 = new FlowUtilityNetwork.NetworkItem(this.ConduitType, Endpoint.Source, OutputCell2, gameObject); NetworkMgr.AddToNetworks(OutputCell2, OutputItem2, true); this.GetComponent <ConduitConsumer>().isConsuming = false; FlowMgr.AddConduitUpdater(OnConduitUpdate); #region no idea what these do, just copy from game codes ElementFilter.OnSpawn() //((KSelectable)((Component)this).GetComponent<KSelectable>()).SetStatusItem(Db.Get().StatusItemCategories.Main, TemperatureFilterProcess.filterStatusItem, (object)this); //this.UpdateConduitExistsStatus(); this.UpdateConduitBlockedStatus(); //ScenePartitionerLayer layer = (ScenePartitionerLayer)null; //switch (this.ConduitType) //{ // case ConduitType.Gas: // layer = GameScenePartitioner.Instance.gasConduitsLayer; // break; // case ConduitType.Liquid: // layer = GameScenePartitioner.Instance.liquidConduitsLayer; // break; // case ConduitType.Solid: // layer = GameScenePartitioner.Instance.solidConduitsLayer; // break; //} //if (layer == null) // return; //this.partitionerEntry = GameScenePartitioner.Instance.Add("TemperatureFilterProcessConduitExists", this.gameObject, OutputCell2, layer, (System.Action<object>)(data => this.UpdateConduitExistsStatus())); #endregion } catch (Exception ex) { KelmenUtils.Log("TemperatureFilterProcess.OnSpawn", ex); throw ex; } }
public static NetworkMgr GetInstance() { if (_instance) { return(_instance); } var networkMgrObj = new GameObject("NetworkMgrObj"); _instance = networkMgrObj.AddComponent <NetworkMgr>(); DontDestroyOnLoad(networkMgrObj); networkMgrObj.hideFlags = HideFlags.HideInHierarchy; return(_instance); }
public TcpServer(NetworkMgr networkMgr, params Option[] opts) { this.networkMgr = networkMgr; sAgentID = AgentID.Gen(); try { foreach (var x in opts) { x.Do(this); } } catch (Exception ex) { sLog.Debug("tcp_server", "init tcp server error {1}", ex.Message); } }
void Awake() { itemInfoMgr = Singleton.GetInstance("ItemsInfoMgr") as ItemsInfoMgr; audioMgr = Singleton.GetInstance("AudioMgr") as AudioMgr; networkMgr = Singleton.GetInstance("NetworkMgr") as NetworkMgr; //Add tools to list list_Tools.Add(new Tool_Handprint()); list_Tools.Add(new Tool_Bloodstain()); //alloc array m_bToolsActive = new bool[list_Tools.Count]; m_iToolResult = new int[list_Tools.Count]; }
static int OnServerLoignOut(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); NetworkMgr obj = (NetworkMgr)ToLua.CheckObject <NetworkMgr>(L, 1); obj.OnServerLoignOut(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int SetIgnoreMsg(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); NetworkMgr obj = (NetworkMgr)ToLua.CheckObject <NetworkMgr>(L, 1); string arg0 = ToLua.CheckString(L, 2); obj.SetIgnoreMsg(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int SendCache(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); NetworkMgr obj = (NetworkMgr)ToLua.CheckObject <NetworkMgr>(L, 1); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.SendCache(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int AddEvent(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); NetworkMgr obj = (NetworkMgr)ToLua.CheckObject <NetworkMgr>(L, 1); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); byte[] arg1 = ToLua.CheckByteBuffer(L, 3); obj.AddEvent(arg0, arg1); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int IgnoreMsg(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); NetworkMgr obj = (NetworkMgr)ToLua.CheckObject <NetworkMgr>(L, 1); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); bool o = obj.IgnoreMsg(arg0); LuaDLL.lua_pushboolean(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int get_ignoreMsgs(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); NetworkMgr obj = (NetworkMgr)o; System.Collections.Generic.Dictionary <int, bool> ret = obj.ignoreMsgs; ToLua.PushSealed(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index ignoreMsgs on a nil value")); } }
static int set_sid(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); NetworkMgr obj = (NetworkMgr)o; int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.sid = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index sid on a nil value")); } }
static int set_ignoreMsgs(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); NetworkMgr obj = (NetworkMgr)o; System.Collections.Generic.Dictionary <int, bool> arg0 = (System.Collections.Generic.Dictionary <int, bool>)ToLua.CheckObject(L, 2, typeof(System.Collections.Generic.Dictionary <int, bool>)); obj.ignoreMsgs = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index ignoreMsgs on a nil value")); } }
static int get_sid(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); NetworkMgr obj = (NetworkMgr)o; int ret = obj.sid; LuaDLL.lua_pushinteger(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index sid on a nil value")); } }
void Awake() { if (Instance != this) { Destroy(gameObject); Debug.Log("DestroyedObjectPersist"); } else { DontDestroyOnLoad(gameObject); } audioMgr = GetComponent<AudioMgr>(); itemsInfoMgr = GetComponent<ItemsInfoMgr>(); networkMgr = GetComponent<NetworkMgr>(); toolMgr = GetComponent<ToolMgr>(); uiMgr = GetComponent<UIMgr>(); }
void Awake() { networkMgr = Singleton.GetInstance("NetworkMgr") as NetworkMgr; PanelInit(); }