static StackObject *AssignFromStack_Instance_1(ref object o, ILIntepreter __intp, StackObject *ptr_of_this_method, IList <object> __mStack)
 {
     ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
     ETModel.SessionComponent @Instance = (ETModel.SessionComponent) typeof(ETModel.SessionComponent).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
     ETModel.SessionComponent.Instance = @Instance;
     return(ptr_of_this_method);
 }
Exemple #2
0
        public async Task OnLogin(BattleServerInfo serverInfo = null)
        {
            try
            {
                if (serverInfo == null)
                {
                    Log.Error("onlogin failure");
                    return;
                }
                Log.Info("onlogin");
                roomId = serverInfo.roomId;

                // 创建一个ETModel层的Session,并且保存到ETModel.SessionComponent中
                ETModel.Session          gateSession  = ETModel.Game.Scene.GetComponent <ETModel.NetOuterComponent>().Create(serverInfo.ipAndPort);
                ETModel.SessionComponent modelSession = ETModel.Game.Scene.GetComponent <ETModel.SessionComponent>();
                if (modelSession == null)
                {
                    modelSession = ETModel.Game.Scene.AddComponent <ETModel.SessionComponent>();
                }
                modelSession.Session = gateSession;

                C2G_LoginGate c2G_LoginGate = new C2G_LoginGate()
                {
                    Token = serverInfo.token, RoomId = serverInfo.roomId, PlayerId = playerUID
                };
                G2C_LoginGate g2C_LoginGate = await modelSession.Session.Call(c2G_LoginGate) as G2C_LoginGate;

                if (g2C_LoginGate != null)
                {
                    if (g2C_LoginGate.Error == ErrorCode.ERR_ConnectGateKeyError)
                    {
                        Game.EventSystem.Run(EventIdType.FightGameEnd);
                    }
                }
                //if (funcs.UsingFrameSync && !func.IsPlayback)
                //{
                //    ETModel.WebSocketBenchmarkComponent testPing = ETModel.Game.Scene.GetComponent<ETModel.WebSocketBenchmarkComponent>();
                //    if (testPing == null)
                //        testPing = ETModel.Game.Scene.AddComponent<ETModel.WebSocketBenchmarkComponent>();
                //    testPing.Session = gateSession;
                //}
                //testPing.UpdatePing();  //开始心跳

                Log.Info("登陆gate成功!");
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }