예제 #1
0
    private void ProcessMsg(GameMsg msg)
    {
        if (msg.err != (int)ErrorCode.None)
        {
            switch ((ErrorCode)msg.err)
            {
            case ErrorCode.AcctIsOnLine:
                GameRoot.AddTips("当前账号已经在线!");
                break;

            case ErrorCode.WrongPass:
                GameRoot.AddTips("密码错误!");
                break;

            case ErrorCode.UpdateDBError:
                GameRoot.AddTips("网络不稳定!");
                PECommon.Log("数据库更新异常", LogType.Error);
                break;
            }
            return;
        }
        switch ((CMD)msg.cmd)
        {
        case CMD.RspLogin:
            LoginSys.Instance.RspLogin(msg);
            break;

        case CMD.RspRename:
            LoginSys.Instance.RspRename(msg);
            break;
        }
    }
예제 #2
0
    public override void OnOperationResponse(OperationResponse operationResponse)
    {
        if (operationResponse.ReturnCode == (short)ReturnCode.Success)
        {
            NetDataLoad.Player(operationResponse.Parameters);

            if (PlayerData.playerID != 0)
            {
                NetGetPlayerData netGetPlayerData = new NetGetPlayerData(PlayerData.playerID);
                LoginSys.Instance.RspEnterGame();
            }
            else
            {
                LoginSys.Instance.RspCreatePlayer();
            }
        }
        else if (operationResponse.ReturnCode == (short)ReturnCode.Default)
        {
            GameRoot.AddTips("登录失败,该账号已经在线!");
        }
        else
        {
            NetRegister netRegister = new NetRegister(_acct, _password);
        }
        NetSvc.Instance.RemoveRequest(this);
    }
예제 #3
0
    public void ResGuide(GameMsg msg)
    {
        ResGuide res = msg.resGuide;

        GameRoot.AddTips(Constants.Color("金币+" + curtTaskData.coin, TxtColor.blue));
        GameRoot.AddTips(Constants.Color("经验+" + curtTaskData.exp, TxtColor.yellow));
        switch (curtTaskData.actID)
        {
        case 0:
            //对话
            break;

        case 1:
            //@TODO副本
            break;

        case 2:
            //TODO强化
            break;

        case 3:
            //TODO体力
            break;

        case 4:
            break;

        case 5:
            break;
        }
        GameRoot.instance.SetPlayerDataByGuide(res);
        mainCityWnd.RefreshUI();
    }
예제 #4
0
    public void ClickEnterBtn()
    {
        audioSvc.PlayUIAudio(Constants.UILoginBtn);
        string _acct = ipAcct.text;
        string _pass = ipPass.text;

        if (_acct != "" && _pass != "")
        {
            PlayerPrefs.SetString("Acct", _acct);
            PlayerPrefs.SetString("Pass", _pass);
            GameMsg msg = new GameMsg
            {
                cmd      = (int)CMD.ReqLogin,
                reqLogin = new ReqLogin
                {
                    acct = _acct,
                    pass = _pass
                }
            };
            netSvc.SendMsg(msg);
            // TODO 网络
            //LoginSys.Instance.RspLogin(msg);
        }
        else
        {
            GameRoot.AddTips("账号或密码为空");
        }
    }
예제 #5
0
    /// <summary>
    /// 进入游戏
    /// 更新/存储本地账号密码
    /// </summary>
    public void ClickEnterBtn()
    {
        audioSvc.PlayUIAudio(Constants.UILoginBtn);

        string acct = iptAcct.text;
        string pass = iptPswd.text;

        if (acct != "" && pass != "")
        {
            // 更新本地保存
            PlayerPrefs.SetString(Acct, acct);
            PlayerPrefs.SetString(Pass, pass);

            // TODO 发送网络消息,请求登录
            GameMsg gameMsg = new GameMsg {
                cmd      = (int)CMD.ReqLogin,
                reqLogin = new ReqLogin {
                    acct = acct,
                    pass = pass
                }
            };
            netSvc.SendMsg(gameMsg);
        }
        else
        {
            GameRoot.AddTips("账号密码不能为空");
        }
    }
예제 #6
0
    private void ClickSendBtn()
    {
        if (!canSend)
        {
            GameRoot.AddTips("消息发送太频繁啦!请稍后再试");
            return;
        }
        if (iptChat.text == null || iptChat.text == "" || iptChat.text == " ")
        {
            GameRoot.AddTips("未输入聊天信息");
            return;
        }

        if (iptChat.text.Length > 20)
        {
            GameRoot.AddTips("输入信息不能超过20个字符");
            return;
        }
        string txt = resSev.SerachFilterWordAndReplace(iptChat.text);

        Debug.Log("GM TXT: " + txt);
        iptChat.text = "";
        netSev.SendMsg(new GameMsg
        {
            cmd     = (int)CMD.SndChat,
            sndChat = new SndChat {
                txt = txt
            }
        });

        canSend = false;
        timerSev.AddTimerTask((id) => { canSend = true; }, 5, 1, TimeUnit.Secound);
    }
예제 #7
0
 public void ClickStrong()
 {
     audioSvc.PlayUIAudio(Constants.FBItemEnter);
     if (PlayerData.StrongArr[currentIndex] < 10)
     {
         if (PlayerData.Level < nextSd.minLv)
         {
             GameRoot.AddTips("角色等级不够!!");
             return;
         }
         if (PlayerData.Coin < nextSd.coin)
         {
             GameRoot.AddTips("金币不够!!!");
             return;
         }
         if (PlayerData.Crystal < nextSd.crystal)
         {
             GameRoot.AddTips("钻石不够!!!");
             return;
         }
         NetStrong netStrong = new NetStrong(currentIndex);
     }
     else
     {
         GameRoot.AddTips("装备等级已经满级!");
     }
 }
예제 #8
0
    public override void OnOperationResponse(OperationResponse operationResponse)
    {
        if (operationResponse.ReturnCode == (short)ReturnCode.Success)
        {
            NetDataLoad.Player(operationResponse.Parameters);
            switch (_loadPlayerDataCode)
            {
            case LoadPlayeDataOverCode.Defalut:
                break;

            case LoadPlayeDataOverCode.RefreshUIByMainCityWnd:
                MainCitySys.Instance.RefreshUIByMainCityWnd();
                break;

            case LoadPlayeDataOverCode.RefreshUIByStrongWnd:
                MainCitySys.Instance.RefreshUIByStrongWnd(_index);
                MainCitySys.Instance.RefreshUIByMainCityWnd();
                TaskSys.Instance.CalcTaskPrgs(3);
                break;

            case LoadPlayeDataOverCode.RefreshUIByTaskWnd:
                MainCitySys.Instance.RefreshUIByMainCityWnd();
                TaskSys.Instance.RefreshUITaskWnd();
                break;

            default:
                break;
            }
        }
        else
        {
            GameRoot.AddTips("该ID角色游戏数据读取失败!请检查该ID是否存在!");
        }
        NetSvc.Instance.RemoveRequest(this);
    }
예제 #9
0
    /// <summary>
    /// 点击进入游戏
    /// </summary>
    public void ClickEnterBtn()
    {
        audioSvc.PlayUIAudio(Constants.UILoginBtn);

        string _acct = iptAcct.text;
        string _pass = iptPass.text;

        if (_acct != "" && _pass != "")
        {
            //更新本地存储的账号密码
            PlayerPrefs.SetString("Acct", _acct);
            PlayerPrefs.SetString("Pass", _pass);

            //发送网络消息,请求登录
            GameMsg msg = new GameMsg {
                cmd      = (int)CMD.ReqLogin,
                reqLogin = new ReqLogin {
                    acct = _acct,
                    pass = _pass
                }
            };
            netSvc.SendMsg(msg);
        }
        else
        {
            GameRoot.AddTips("账号或密码为空");
        }
    }
예제 #10
0
    ///点击进入游戏
    public void ClickEnterBtn()
    {
        audioSvc.PlayUIAudio(Constants.LoginUi);

        string acctd = iptAcct.text;
        string pswd  = iptPsw.text;

        if (acctd != "" && pswd != "")
        {
            PlayerPrefs.SetString("Account", acctd);
            PlayerPrefs.SetString("passwd", pswd);

            //TODO 发送网络消息 请求登录
            GameMsg msg = new GameMsg()
            {
                cmd      = (int)CMD.ReqLogin,
                reqLogin = new ReqLogin
                {
                    acct = acctd,
                    pass = pswd
                }
            };
            netSvc.SendMsg(msg);
            //TOREMOVE
        }
        else
        {
            GameRoot.AddTips("账号或密码为空");
        }
    }
예제 #11
0
    /// <summary>
    /// 点击进入游戏按钮
    /// </summary>
    public void ClickEnterButton()
    {
        audioSvc.PlayUIAudio(Constants.UILoginBtn);
        string mAcct = iptAcct.text;
        string mPwd  = iptPwd.text;

        // 输入合法
        if (mAcct != "" && mPwd != "")
        {
            //更新本地存储的账号和密码
            PlayerPrefs.SetString("Acct", mAcct);
            PlayerPrefs.SetString("Pwd", mPwd);

            // 发送网络消息,请求登录
            GameMsg msg = new GameMsg {
                cmd      = (int)CMD.ReqLogin,
                reqLogin = new ReqLogin {
                    acct = mAcct,
                    pwd  = mPwd
                }
            };
            // 发送消息给服务器
            netSvc.SendMsg(msg);
        }
        // 输入不合法
        else
        {
            GameRoot.AddTips("输入不合法");
        }
    }
예제 #12
0
    public void OnClickEnterBtn()
    {
        audioSvc.PlayUIAudio(Constants.UILoginBtn);
        string _acct = iptAcct.text;
        string _pass = iptPass.text;

        if (_acct != "" && _pass != "")
        {
            PlayerPrefs.SetString("Acct", _acct);
            PlayerPrefs.SetString("Pass", _acct);

            netSvc.SendMsg(new GameMsg()
            {
                cmd      = (int)CMD.ReqLogin,
                reqLogin = new ReqLogin()
                {
                    acct = _acct,
                    pass = _pass
                }
            });
        }
        else
        {
            GameRoot.AddTips("账号或密码为空");
        }
    }
예제 #13
0
    //点击登录
    public void BtnLoginEnter()
    {
        audioService.PlayUIAudio(Constants.uiLoginBtn);

        string account  = accText.text;
        string passWord = pwdText.text;

        if (account != "" && passWord != "")
        {
            // 更新本地的存储
            PlayerPrefs.SetString("Account", account);
            PlayerPrefs.SetString("PassWord", passWord);

            //todo发送网络消息 请求登录
            GameMsg msg = new GameMsg
            {
                cmd      = (int)CMD.ReqLogin,
                reqLogin = new ReqLogin
                {
                    account  = account,
                    password = passWord
                }
            };
            netService.SendMsg(msg);
        }
        else
        {
            GameRoot.AddTips("账号密码为空");
        }
    }
예제 #14
0
    public void OnClickEnterBtn()
    {
        _audioSvc.PlayUIAudio(Constants.cLoginBtnSound);

        //获取账号密码并保存
        string accountStr = inputAccount.text;
        string pwdStr     = inputPwd.text;

        if (accountStr != "" && pwdStr != "")
        {
            PlayerPrefs.SetString(Constants.cAccountKey, accountStr);
            PlayerPrefs.SetString(Constants.cPwdKey, pwdStr);

            //发送网络消息,请求登录
            NetMsg msg = new NetMsg
            {
                cmd         = (int)MsgCommand.Cmd_ReqLogin,
                reqLoginMsg = new RequestLoginMsg {
                    _account = accountStr, _pwd = pwdStr
                }
            };
            _netSvc.SendMsg(msg);

            //TO Remove
            //LoginSys.Instance.RspLogin();
        }
        else
        {
            GameRoot.AddTips("账号或密码为空!");
        }
    }
예제 #15
0
    public void ClickEnterBtn()
    {
        audioSvc.PlayUIAudio(Constants.UILoginBtn);
        string acct = iptAcct.text;
        string pass = iptPass.text;

        if (acct != "" && pass != "")
        {
            PlayerPrefs.SetString(AcctKey, acct);
            PlayerPrefs.SetString(PassKey, pass);

            GameMsg msg = new GameMsg
            {
                cmd      = (int)CMD.ReqLogin,
                reqLogin = new ReqLogin
                {
                    acct = acct,
                    pass = pass
                }
            };
            netSvc.SendMsg(msg);
        }
        else
        {
            GameRoot.AddTips("账号或密码为空");
        }
    }
예제 #16
0
    /// <summary>
    /// 自动引导任务的响应
    /// </summary>
    /// <param name="msg"></param>
    public void RspGuideTask(NetMsg msg)
    {
        ResponseGuideTask taskData = msg.rspGuideTask;

        GameRoot.AddTips("任务奖励 金币 + " + curTaskData.gainCoin + "经验 + " + curTaskData.gainExp);

        switch (curTaskData.targetTaskID)
        {
        case 0:     /*与智者对话*/
            break;

        case 1:     /*进入副本*/
            OpenCopyerWnd();
            break;

        case 2:     /*强化*/
            OpenStrongerWnd();
            break;

        case 3:     /*体力购买*/
            OpenShopWnd(Constants.ShopType.ShopType_BuyPower);
            break;

        case 4:     /*金币铸造*/
            OpenShopWnd(Constants.ShopType.ShopType_MakeCoin);
            break;

        case 5:     /*世界聊天*/
            OpenChatWnd();
            break;
        }

        GameRoot.Instance.SetPlayerDataByGuideTask(taskData);
        _mainCityWnd.RefreshUI();
    }
예제 #17
0
    private void ProcessMsg(GameMsg msg)
    {
        if (msg.err != (int)ErrorCode.Node)
        {
            switch ((ErrorCode)msg.err)
            {
            //case ErrorCode.Node:
            //    break;
            case ErrorCode.AcctisOnline:
                GameRoot.AddTips("当前账号已上线");
                break;

            case ErrorCode.WrongPass:
                GameRoot.AddTips("密码错误");
                break;
            }
            return;
        }
        switch ((CMD)msg.cmd)
        {
        //case CMD.None:
        //    break;
        //case CMD.ReqLogin:
        //    break;
        case CMD.RspLogin:
            LoginSys.Instance.RspLogin(msg);
            break;
        }
    }
예제 #18
0
 public void NoFullReady(GameMsg msg)
 {
     audioSvc.PlayAudioInUI(audioSvc.uiAudio);
     //传递玩家数据
     PECommon.Log("有玩家还没准备。");
     GameRoot.AddTips(Constants.GetColorStr("有玩家还没准备。", TextColor.Red));
 }
예제 #19
0
    public void ClickStrongBtn()
    {
        audioSvc.PlayUIAudio(Constants.UIClickBtn);

        if (pd.strongArr[currentIndex] < 10)
        {
            if (pd.lv < nextSd.minlv)
            {
                GameRoot.AddTips("角色等级不够");
                return;
            }
            if (pd.coin < nextSd.coin)
            {
                GameRoot.AddTips("金币数量不够");
                return;
            }
            if (pd.crystal < nextSd.crystal)
            {
                GameRoot.AddTips("水晶不够");
                return;
            }

            netSvc.SendMsg(new GameMsg {
                cmd       = (int)CMD.ReqStrong,
                reqStrong = new ReqStrong {
                    pos = currentIndex
                }
            });
        }
        else
        {
            GameRoot.AddTips("星级已经升满");
        }
    }
예제 #20
0
    private void ClickStrongBtn()
    {
        audioSvc.PlayUIAudio(Constants.UIClickBtn);

        if (playerData.strongArr[currentIndex] < 10)
        {
            if (playerData.lv < nextSc.minlv)
            {
                GameRoot.AddTips("当前等级不够");
                return;
            }
            if (playerData.coin < nextSc.coin)
            {
                GameRoot.AddTips("当前金币不够");
                return;
            }
            if (playerData.crystal < nextSc.crystal)
            {
                GameRoot.AddTips("当前水晶不够");
                return;
            }

            netSvc.SendMsg(new GameMsg {
                cmd       = (int)CMD.ReqStrong,
                reqStrong = new ReqStrong {
                    pos = currentIndex
                }
            });
        }
        else
        {
            GameRoot.AddTips("星级已经升满");
        }
    }
예제 #21
0
    /// <summary>
    /// 点击进入游戏
    /// </summary>
    public void ClickEnterBtn()
    {
        audioSev.PlayUIAudio(Constans.UILoginBtnAudio);

        string acct = iptAcct.text;
        string pass = iptPass.text;

        if (acct != "" && pass != "")
        {
            // 更新存储本地的账号密码
            PlayerPrefs.SetString("Acct", acct);
            PlayerPrefs.SetString("Pass", pass);

            // TODO 发送网络消息,请求登录
            netSev.SendMsg(new GameMsg
            {
                cmd      = (int)CMD.ReqLogin,
                reqLogin = new ReqLogin
                {
                    account = acct,
                    pass    = pass
                }
            });
            // TO Remove
            //LoginSys.Instance.RespLogin();
        }
        else
        {
            GameRoot.AddTips("账号或密码不能为空!");
        }
    }
예제 #22
0
    /// <summary>
    /// 点击进入游戏
    /// </summary>
    public void ClickEnterBtn()
    {
        audioSvc.PlayUIAudio(Constants.UILoginBtn);

        string account  = iptAcct.text;
        string password = iptPass.text;

        if (account != "" && password != "")
        {
            //更新本地存储的账号密码
            PlayerPrefs.SetString("Acct", account);
            PlayerPrefs.SetString("Pass", password);

            //TODO 发送网络消息,请求登录
            GameMsg msg = new GameMsg
            {
                cmd      = (int)CMD.ReqLogin,
                reqLogin = new ReqLogin
                {
                    Acct = account,
                    Pass = password,
                }
            };
            netSvc.SendMsg(msg);
        }
        else
        {
            GameRoot.AddTips("账号或密码为空");
        }
    }
예제 #23
0
    public void RspGuide(GameMsg msg)
    {
        RspGuide data = msg.rspGuide;

        GameRoot.AddTips(Constants.Color("任务奖励 金币+" + curtTaskData.coin + " 经验+" + curtTaskData.exp, TxtColor.Blue));
        switch (curtTaskData.actID)
        {
        case 0:

            break;

        case 1:

            break;

        case 2:

            break;

        case 3:

            break;

        case 4:

            break;

        case 5:

            break;
        }
        GameRoot.Instance.SetPlayerDataByGuide(data);
        mainCityWnd.RefreshUI();
    }
예제 #24
0
    public void RspTakeReward(GameMsg msg)
    {
        RspTakeTaskReward data = msg.rspTakeTask;

        GameRoot.Instance.SetPlayerDataByTakeTask(data);
        GameRoot.AddTips(Constans.ColorStr("获取经验:" + data.exp + " 获取金币:" + data.coin, TxtColor.Green));
        taskWindow.RefreshUI();
        mainCityWindow.RefreshUI();
    }
예제 #25
0
 public void OnAutoTaskClick()
 {
     if (guideConfigures == null)
     {
         GameRoot.AddTips("更多任务敬请期待");
         return;
     }
     MainCitySystem.Instance.RunTask(guideConfigures);
 }
예제 #26
0
    public void RspLogin()
    {
        GameRoot.AddTips("登录成功");

        //打开角色创建界面
        createWnd.SetWndState();
        //关闭登录界面
        loginWnd.SetWndState(false);
    }
예제 #27
0
    public void RspBuy(GameMsg msg)
    {
        RspBuy data = msg.val as RspBuy;

        GameRoot.Instance.SetPlayerDataByBuy(data);
        GameRoot.AddTips("购买成功");

        mainCityWnd.RefreshUI();
        buyWnd.SetWndState(false);
    }
예제 #28
0
    public void RspBuyInfo(NetMsg msg)
    {
        ResponseBuyInfo data = msg.rspBuyInfo;

        GameRoot.Instance.UpdatePlayerDataOfBuy(data);
        GameRoot.AddTips("购买成功!");

        _mainCityWnd.RefreshUI();
        _shopWnd.SetWndState(false);
    }
예제 #29
0
 public override void OnOperationResponse(OperationResponse operationResponse)
 {
     if (operationResponse.ReturnCode == (short)ReturnCode.Success)
     {
         GameRoot.AddTips("任务数据更新成功");
     }
     else
     {
     }
     NetSvc.Instance.RemoveRequest(this);
 }
예제 #30
0
    /// <summary>
    /// 强化的服务器回应
    /// </summary>
    public void RspStrong(GameMsg msg)
    {
        int fightPre = PECommon.GetFightByProps(GameRoot.Instance.PlayerData); // 之前的战力

        GameRoot.Instance.SetPlayerDataByStrong(msg.rspStrong);
        int fightNow = PECommon.GetFightByProps(GameRoot.Instance.PlayerData); // 新的战力,强化后

        GameRoot.AddTips(Constants.Color("战力提升 " + (fightNow - fightPre), TxtColor.Blue));
        strongWnd.UpdateUI();
        mainCityWnd.RefreshUI();
    }