Пример #1
0
        private static void HandleLoginSuccess(Protos.LS2GC_AskLoginRet gcLoginRet, uint sid, LoginContext context)
        {
            ulong gcNID = GuidHash.GetUInt64();

            //通知cs,客户端登陆成功
            Protos.LS2CS_GCLogin csLogin = ProtoCreator.Q_LS2CS_GCLogin();
            csLogin.GcNID      = gcNID;
            csLogin.Id         = context.id;
            csLogin.Ukey       = context.ukey;
            csLogin.Channel    = context.channel;
            csLogin.Browser    = context.browser;
            csLogin.Platform   = context.platform;
            csLogin.SessionKey = context.sessionKey;
            csLogin.UnionID    = context.unionID;
            csLogin.Nickname   = context.nickname;
            csLogin.Avatar     = context.avatar;
            csLogin.Gender     = context.gender;
            csLogin.Money      = context.money;
            csLogin.Diamoned   = context.diamoned;
            csLogin.Rank       = context.rank;
            csLogin.Exp        = context.exp;
            csLogin.Champions  = context.champions;
            csLogin.ActorID    = context.actorID;
            LS.instance.netSessionMgr.Send(SessionType.ServerL2CS, csLogin,
                                           RPCEntry.Pop(OnGCLoginCSRet, gcLoginRet, sid, gcNID));
        }
Пример #2
0
        public T Create <T>() where T : Entity, new()
        {
            T entity = new T();

            entity.rid    = GuidHash.GetUInt64();
            entity.battle = this._battle;
            this._idToEntity[entity.rid] = entity;
            this._entities.Add(entity);
            entity.Awake();
            entity.Synchronize();
            return(entity);
        }
Пример #3
0
        private static void HandleInput(string cmd)
        {
            string[] pairs = cmd.Split(' ');
            switch (pairs[0])
            {
            case "a":
            {
                MatchRoomUser user = new MatchRoomUser(GuidHash.GetUInt64(), int.Parse(pairs[1]));
                _matchingSystems[0].Join(user);
            }
            break;

            case "d":
                break;

            case "b":
            {
                int count = int.Parse(pairs[1]);
                for (int i = 0; i < count; i++)
                {
                    ulong id   = GuidHash.GetUInt64();
                    int   rank = _rnd.Next(0, 1000);
                    //Console.WriteLine( $"add id:{id}, rank:{rank}" );
                    MatchRoomUser user = new MatchRoomUser(id, rank);
                    _matchingSystems[0].Join(user);
                }
            }
            break;

            case "x":
                foreach (MatchSystem matchingSystem in _matchingSystems)
                {
                    Console.WriteLine(matchingSystem.Dump());
                }
                break;

            case "cls":
                Console.Clear();
                break;
            }
        }