示例#1
0
        public void SendSignIn()
        {
            var transaction = new ServerActionTransaction();

            transaction.Actions.Add(new AccountData
            {
                Id                 = Id,
                UserName           = Username,
                Level              = Level,
                LevelXp            = Xp,
                NextLevelXp        = 280u,
                Coins              = Coins,
                Gems               = Gems,
                ClientVersionValid = true,
                Status             = AccountStatus.VALIDATED,
            });

            // TODO: implement this
            // need to send account chest information otherwise client exception
            transaction.Actions.Add(new AccountChestData
            {
                Id          = 0,
                ChestType   = ChestType.BLUE,
                Count       = 0,
                OpenedCount = 0
            });

            transaction.Actions.Add(new AccountChestData
            {
                Id          = 1,
                ChestType   = ChestType.ORANGE,
                Count       = 0,
                OpenedCount = 0
            });

            transaction.Actions.Add(new AccountChestData
            {
                Id          = 2,
                ChestType   = ChestType.PINK,
                Count       = 0,
                OpenedCount = 0
            });

            // TODO: implement this
            // need to send to move the client to the main menu and not the tutorial screen
            transaction.Actions.Add(new CompletedQuestData
            {
                Id             = 5,
                CompletionDate = 0
            });

            transaction.Actions.Add(new SignInSuccessAction());
            Session.Send(transaction);
        }
示例#2
0
        public void Send(ServerActionTransaction transaction)
        {
            var sb = new StringBuilder();

            foreach (ServerAction action in transaction.Actions)
            {
                sb.Append($"{sequence}|{NetworkManager.DeMarshal(action)}\n");
            }

            Send(sb.ToString());
            sequence++;
        }