Beispiel #1
0
 public void OnClickMoney()
 {
     CommonCommand.ExecuteLongMain(Client2ServerList.GetInst().C2S_STORE_BUY_HERO, new ArrayList()
     {
         (byte)HeroId, false
     });
 }
Beispiel #2
0
        private void OnConfirm()
        {
            string command = commandInput.text;

            if (command.Equals(string.Empty))
            {
                return;
            }

            string[]  param     = command.Split(' ');
            ArrayList paramList = new ArrayList()
            {
                param[0], param[1], param.Length == 3 ? param[2] : string.Empty
            };

            int id = int.Parse(param[0]);

            if ((id >> 1 << 1) == id)
            {
                CommonCommand.ExecuteLongBattle(Client2ServerList.GetInst().C2S_GM, paramList);
            }
            else
            {
                CommonCommand.ExecuteLongMain(Client2ServerList.GetInst().C2S_GM, paramList);
            }
        }
Beispiel #3
0
 private void OnClickMulti()
 {
     SceneLoader.IsSingle = false;
     CommonCommand.ExecuteLongMain(Client2ServerList.GetInst().C2S_LOGIN_PVP_REQUEST, new ArrayList()
     {
         (byte)2
     });
 }
Beispiel #4
0
 public void LoadDouble(int roomId, int seed, int frequency, int stairs, List <BattlePlayerData> others)
 {
     BattleType = 2;
     SetData(roomId, seed, frequency, stairs, true);
     LoadMy(PositionMgr.vecFieldPosM);
     LoadOther(PositionMgr.vecFieldPosE, others[0], 1, 0.8f);
     LoadPlayerInfo(PlayerData.PlayerId, PlayerData.Nickname, PlayerData.CurScene, PlayerData.CurHP, 0);
     LoadPlayerInfo(others[0], 1);
     CommonCommand.ExecuteLongBattle(Client2ServerList.GetInst().C2S_BATTLE_LOADED, new ArrayList()
     {
     });
 }
Beispiel #5
0
 public void OnClickCoin()
 {
     if (PlayerData.Coin < int.Parse(Coin))
     {
         MsgBoxPanel.ShowMsgBox("Warning", string.Format("Not enough Coins !"), 1);
         return;
     }
     MsgBoxPanel.MsgCallback OnOk = () => { CommonCommand.ExecuteLongMain(Client2ServerList.GetInst().C2S_STORE_BUY_HERO, new ArrayList()
         {
             (byte)HeroId, true
         }); };
     MsgBoxPanel.ShowMsgBox("Buy Hero", string.Format("Spend {0} Coins to buy {1} ?", Coin, Name.text), 2, OnOk);
 }
Beispiel #6
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.CompareTag("Role"))
     {
         ResourceMgr.PushItem(this);
         BattleHero hero = collision.GetComponent <BattleHero>();
         BattleManager.GetInst().EnqueueSkill(hero.PlayerId, Type);
         CommonCommand.ExecuteLongBattle(Client2ServerList.GetInst().C2S_BATTLE_GET_ITEM, new ArrayList()
         {
             (byte)Type
         });
     }
 }
Beispiel #7
0
 private void ClosePanel()
 {
     _gameObject.SetActive(false);
     for (int i = 0; i < _lstSceneItems.Count; ++i)
     {
         if (_lstSceneItems[i].Toggle.isOn && i != PlayerData.CurScene)
         {
             CommonCommand.ExecuteLongMain(Client2ServerList.GetInst().C2S_PLAYER_SET_SCENE, new ArrayList()
             {
                 (byte)i
             });
         }
     }
 }
Beispiel #8
0
 private void OnTriggerEnter2D(Collider2D collider)
 {
     if (collider.CompareTag("Role"))
     {
         if (BattleManager.GetInst().BattleType == 2)
         {
             BattleHero hero = collider.GetComponent <BattleHero>();
             CommonCommand.ExecuteLongBattle(Client2ServerList.GetInst().C2S_BATTLE_HERO_FAILED, new ArrayList()
             {
                 hero.PlayerId
             });
         }
     }
 }
Beispiel #9
0
 public void OnPlatformLogin()
 {
     _loginParam = new ArrayList()
     {
         ApplicationConst.PlatformID,
         ApplicationConst.ChannelID,
         DeviceInfo.GetDeviceInfo(),
         System.Guid.NewGuid().ToString(),
         SystemInfo.deviceUniqueIdentifier,
         PlayerInfo.Account,
         PlayerInfo.Token
     };
     CommonCommand.ExecuteShort(Client2ServerList.GetInst().C2S_LOGIN_SHORT, _loginParam, true);
 }
Beispiel #10
0
        public void LoadFive(int roomId, int seed, int frequency, int stairs, List <BattlePlayerData> others)
        {
            BattleType = 2;
            SetData(roomId, seed, frequency, stairs, true);
            LoadMy(PositionMgr.vecFieldPosM);

            for (int i = 0; i < others.Count; ++i)
            {
                LoadOther(PositionMgr.arrVecFieldPosE[i], others[i], i + 1, 0.4f);
                LoadPlayerInfo(others[i], i + 1);
            }
            CommonCommand.ExecuteLongBattle(Client2ServerList.GetInst().C2S_BATTLE_LOADED, new ArrayList()
            {
            });
        }
Beispiel #11
0
 private void OnMouseUp()
 {
     _ray = BattleManager.GetInst().BattleCam.ScreenPointToRay(Input.mousePosition);
     if (Physics.Raycast(_ray, out _hit, 1000, 1 << LayerMask.NameToLayer("SkillBtn")))
     {
         int playerIndex = int.Parse(_hit.collider.tag);
         int playerId    = BattleManager.GetInst().IndexToPlayer(playerIndex - 1);
         CommonCommand.ExecuteLongBattle(Client2ServerList.GetInst().C2S_BATTLE_RELEASE_SKILL, new ArrayList()
         {
             playerId, (byte)Type, IsMainSkill
         });
     }
     _anim["SkillBtn2"].time  = _anim["SkillBtn2"].length;
     _anim["SkillBtn2"].speed = -1;
     _anim.Play("SkillBtn2");
 }
Beispiel #12
0
        public void ReduceHp(int reduceValue)
        {
            int curHp = BattleManager.GetInst().GetHp(PlayerId);
            int newHp = Mathf.Max(0, curHp - reduceValue);

            if (BattleManager.GetInst().BattleType == 1 || IsRobot)
            {
                BattleManager.GetInst().SyncHp(PlayerId, newHp);
            }
            else
            {
                CommonCommand.ExecuteLongBattle(Client2ServerList.GetInst().C2S_BATTLE_SYNC_HP, new ArrayList()
                {
                    (byte)newHp
                });
            }
        }
Beispiel #13
0
        private void OnConfirm()
        {
            string command = commandInput.text;

            if (command.Equals(string.Empty))
            {
                return;
            }

            if (ClientGM(command))
            {
                return;
            }

            string[]  param     = command.Split(' ');
            ArrayList paramList = new ArrayList()
            {
                param[0], param[1], param.Length == 3 ? param[2] : string.Empty
            };

            CommonCommand.ExecuteShort(Client2ServerList.GetInst().C2S_GM, paramList);
        }
Beispiel #14
0
        private const int LONG_MESSAGE_END   = 5;               //长链接消息结束

        public override void ProcessMessage(ConnectBase conn, ByteBuffer data)
        {
            int type, errCode;
            int moduleId = data.readByte();

            switch (moduleId)
            {
            case LONG_CONNECTED:
                type = data.readByte();
                if (type == 0)
                {
                    LoginPanel.GetInst().OnPlatformLogin();
                }
                else
                {
                    CommonCommand.ExecuteLongBattle(Client2ServerList.GetInst().C2S_BATTLE_LOGIN, new ArrayList()
                    {
                        PlayerData.PlayerId
                    });
                }

                //ConnectLong.GetInst().ConnectedFunc();
                break;

            case LCONNECT_EXCEPTION:
                type    = data.readByte();
                errCode = data.readInt();
                if (10049 == errCode ||                                 //Cannot assign requested address
                    10051 == errCode ||                                 //Network is unreachable
                    10054 == errCode ||                                 //Connection reset by peer
                    10057 == errCode ||                                 //Socket is not connected
                    10058 == errCode ||                                 //Cannot send after socket shutdown
                    10060 == errCode ||                                 //Connection timed out
                    10061 == errCode ||                                 //Connection refused
                    0 == errCode)                                       //Directly send error
                {
                    if (type == 0)
                    {
                        ApplicationEntry.ToLoginScene();
                    }
                }
                else if (10053 != errCode)
                {
                    Debug.LogError(string.Format("LCONNECT_EXCEPTION-Code:{0}", errCode));
                }
                break;

            case SCONNECT_EXCEPTION:
                errCode = data.readInt();
                MsgBoxPanel.MsgCallback Reconnect = () =>
                {
                    ConnectShort co = (ConnectShort)conn;
                    SocketHandler.GetInst().ShortSend(co.m_Data, co.m_bFlag, co.m_bNeedEncrypt);
                    SocketHandler.ShortSendBackFun();
                };
                MsgBoxPanel.ShowMsgBox(string.Empty, (string)ApplicationConst.dictStaticText["22"], 1, Reconnect);
                break;

            case LONG_MESSAGE_END:
                Connecting.GetInst().ForceHide();
                break;

            default:
                break;
            }
        }
Beispiel #15
0
 private void CancelSearch()
 {
     CommonCommand.ExecuteLongMain(Client2ServerList.GetInst().C2S_LOGIN_PVP_CANCEL, new ArrayList()
     {
     });
 }