예제 #1
0
 private void matchClick()
 {
     setObjectsActive(true);
     // 向服务器发起开始匹配的请求
     socketMsg.Change(OpCode.MATCH, MatchCode.ENTER_CREQ, null);
     Dispatch(AreaCode.NET, 0, socketMsg);
 }
예제 #2
0
    /// <summary>
    /// 检测是否胜利
    /// </summary>
    private void checkWin()
    {
        foreach (var item in OtherArmyCtrlList)
        {
            if (item.armyState.Class == ArmyClassType.Hero)
            {
                //如果敌方还有英雄单位
                return;
            }
        }

        foreach (var item in MapManager.OtherLineMapPointCtrls)
        {
            if (item.LandArmy != null && item.LandArmy.GetComponent <ArmyCtrl>() != null)
            {
                //如果敌方胜利线有我方单位
                //发送消息
                socketMsg.Change(OpCode.FIGHT, FightCode.GAME_OVER_CREQ, "游戏结束");
                Dispatch(AreoCode.NET, NetEvent.SENDMSG, socketMsg);
                //显示结束面板
                Dispatch(AreoCode.UI, UIEvent.SHOW_WIN_OVER_PANEL, "游戏结束面板");
            }
            else if (item.SkyArmy != null && item.SkyArmy.GetComponent <ArmyCtrl>() != null)
            {
                // 如果敌方胜利线有我方单位
                //发送消息
                socketMsg.Change(OpCode.FIGHT, FightCode.GAME_OVER_CREQ, "游戏结束");
                Dispatch(AreoCode.NET, NetEvent.SENDMSG, socketMsg);
                //显示结束面板
                Dispatch(AreoCode.UI, UIEvent.SHOW_WIN_OVER_PANEL, "游戏结束面板");
            }
        }
    }
예제 #3
0
    /// <summary>
    /// 不出
    /// </summary>
    private void NDealClick()
    {
        //发送不出牌
        socketMsg.Change(OpCode.FIGHT, FightCode.PASS_CREQ, null);
        Dispatch(AreaCode.NET, 0, socketMsg);

        //btnDeal.gameObject.SetActive(false);
        //btnNDeal.gameObject.SetActive(false);
    }
예제 #4
0
    private void BtnMathchClick()
    {
        //发起匹配请求  也可以穿过去一个id,假如客户端保存了自身账号ID 发消息的时候可以吧自身ID 发过去,然后服务器端进行判断ID是否与client对应ID一致
        socketMsg.Change(OpCode.MATCH, MatchCode.ENTER_CREQ, null);
        Dispatch(AreaCode.NET, 0, socketMsg);

        SetObjectActive(true);

        this.btnMatch.interactable = false;
    }
예제 #5
0
        /// <summary>
        /// 投资请求
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        public SocketMsg <Dictionary <string, string> > ReqInvestMsg(object msg)
        {
            Dictionary <string, string> t = new Dictionary <string, string>();

            t.Add("username", PlayerPrefs.GetString("username"));
            t.Add("token", PlayerPrefs.GetString("token"));
            t.Add("investId", msg.ToString());
            messageData.Change("consumer/player", "playerInvest", t);
            socketMsg.Change(LoginInfo.ClientId, "投资请求", messageData);
            return(socketMsg);
        }
예제 #6
0
    /// <summary>
    /// 先祖头盔协程
    /// </summary>
    /// <returns></returns>
    private IEnumerator AncestorHelmets()
    {
        //开始选择兵种控制器
        if (selectOtherCardCtrl == null)
        {
            Dispatch(AreoCode.UI, UIEvent.PROMPT_PANEL_EVENTCODE, "请先选择非指令卡");
            yield break;
        }

        bool hasInfantry = false;

        foreach (var item in myArmyCtrlManager.CardCtrllist)
        {
            if (item.armyState.Name == OrcArmyCardType.Infantry)
            {
                //如果场上有兽族步兵
                hasInfantry = true;
                break;
            }
        }

        if (!hasInfantry)
        {
            //如果场上没有兽族步兵
            Dispatch(AreoCode.UI, UIEvent.PROMPT_PANEL_EVENTCODE, "场上没有兽族步兵");
            yield break;
        }

        /*if (selectArmyCtrl == null)
         * {
         *  Dispatch(AreoCode.UI, UIEvent.PROMPT_PANEL_EVENTCODE, "请先选择使用单位");
         *  yield break;
         * }*/


        foreach (var item in myArmyCtrlManager.CardCtrllist)
        {
            if (item.armyState.Name == OrcArmyCardType.Infantry)
            {
                //所有在场上的兽族步兵血量加一,最大血量不变
                item.armyState.Hp++;
            }
        }
        //发送消息给其他人
        socketMsg.Change(OpCode.FIGHT, FightCode.USE_OTHERCARD_CREQ, selectOtherCardCtrl.cardDto);
        Dispatch(AreoCode.NET, NetEvent.SENDMSG, socketMsg);
        //提示消息
        Dispatch(AreoCode.UI, UIEvent.PROMPT_PANEL_EVENTCODE, "先祖头盔使用成功");
        //移除先祖头盔卡牌
        Dispatch(AreoCode.CHARACTER, CharacterEvent.REMOVE_MY_CARDS, selectOtherCardCtrl.cardDto);
        //状态重置
        selectArmyCtrl      = null;
        selectOtherCardCtrl = null;
    }
예제 #7
0
    private void matchClick()
    {
        //向服务器发起开始匹配的请求
        //  可以怎么做,假如客户端保存了自身的账号id的话,发消息的时候,都把自身的id发送给服务器
        socketMsg.Change(OpCode.MATCH, MatchCode.ENTER_CREQ, null);
        Dispatch(AreaCode.NET, 0, socketMsg);

        setObjectsActive(true);

        //按钮隐藏掉
        this.btnMatch.interactable = (false);
    }
예제 #8
0
 private void readyClick()
 {
     socketMsg.Change(OpCode._21Multi, _21MultiCode.READY_CREQ, null);
     Dispatch(AreaCode.NET, 0, socketMsg);
     //321动画
     //Dispatch(AreaCode.UI, UIEvent.SHOW_COUNT_DOWN_PANEL, null);
 }
예제 #9
0
 private void startClick()
 {
     /*
      * btnStart.gameObject.SetActive(false);
      * btnGet.gameObject.SetActive(true);
      * btnNGet.gameObject.SetActive(true);
      * btnDouble.gameObject.SetActive(true);
      */
     socketMsg.Change(OpCode._21Single, _21SingleCode.START_CREQ, null);
     Dispatch(AreaCode.NET, 0, socketMsg);
 }
예제 #10
0
    /// <summary>
    /// 下一回合按钮事件
    /// </summary>
    private void nextTurnBtnClicker()
    {
        if (TurnCount == 1 && MyCharacterCtrl.Instance.hasTypeCard(CardType.ARMYCARD))
        {
            //第一回合放置所有单位
            Dispatch(AreoCode.UI, UIEvent.PROMPT_PANEL_EVENTCODE, "第一回合必须放置所有单位");
            return;
        }
        socketMsg.Change(OpCode.FIGHT, FightCode.NEXT_TURN_CREQ, "下一回合");
        Dispatch(AreoCode.NET, NetEvent.SENDMSG, socketMsg);
        Dispatch(AreoCode.UI, UIEvent.SHOW_HIDE_PLANE, "对方回合");
        Dispatch(AreoCode.UI, UIEvent.SHOW_WAIT_PANEL, "");

        Button_NextTurn.interactable = false;
    }
예제 #11
0
    private void enterClick()
    {
        //fix bug
        //Dispatch(AreaCode.SCENE, SceneEvent.LOAD_SCENE, 2);
        socketMsg.Change(OpCode._21Multi, _21MultiCode.ENTER_CREQ, null);
        Dispatch(AreaCode.NET, 0, socketMsg);
        LoadSceneMsg msg = new LoadSceneMsg(4,
                                            delegate()
        {
            Debug.Log("4加载完成!");
            //Dispatch(AreaCode.UI, UIEvent.MULTI_PLAYER_CHANGE_IDENTITY, Models.GameModel.UserDto.Id);
        });

        Dispatch(AreaCode.SCENE, SceneEvent.LOAD_SCENE, msg);
    }
예제 #12
0
    /// <summary>
    /// 登录按钮的点击事件处理
    /// </summary>
    private void loginClick()
    {
        if (string.IsNullOrEmpty(inputAccount.text))
        {
            promptMsg.Change("登录的用户名不能为空!", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
            return;
        }
        if (string.IsNullOrEmpty(inputPassword.text))
        {
            promptMsg.Change("登录的密码不能为空!", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
            return;
        }
        if (inputPassword.text.Length < 4 || inputPassword.text.Length > 16)
        {
            promptMsg.Change("登录的密码长度不合法,应该在4-16个字符之内!", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
            return;
        }

        AccountDto dto = new AccountDto(inputAccount.text, inputPassword.text);

        socketMsg.Change(OpCode.ACCOUNT, AccountCode.LOGIN, dto);
        Dispatch(AreaCode.NET, 0, socketMsg);
    }
예제 #13
0
 void BtnMatchClick()
 {
     Dispatch(AreaCode.UI, UIEvent.MATCH_PANEL_ACTIVE, true);
     //向服务器发起开始匹配的请求
     socketMsg.Change(OpCode.MATCH, MatchCode.ENTER_CREQ, null);
     Dispatch(AreaCode.NET, 0, socketMsg);
 }
예제 #14
0
    void SyncPositionAndRotation_CREQ()
    {
        if (!isLife)
        {
            Destroy(this);
        }

        for (int i = 0; i < playerNames.Length; i++)
        {
            if (gameObject.name.Equals(playerNames[i]))
            {
                color = i + 1;
            }
        }

        //将本地玩家标识上传到父类 方便使用
        if (identifyColor == 0)
        {
            identifyColor = color;
        }

        playerDto_CREQ.color = color;
        playerDto_CREQ.posX  = transform.position.x;
        playerDto_CREQ.posY  = transform.position.y;
        playerDto_CREQ.posZ  = transform.position.z;
        playerDto_CREQ.rotX  = transform.localEulerAngles.x;
        playerDto_CREQ.rotY  = transform.localEulerAngles.y;
        playerDto_CREQ.rotZ  = transform.localEulerAngles.z;

        //发送消息给Net模块 进行玩家位置相关信息的同步
        socketMsg.Change(OpCode.Player, PlayerCode.PLAYER_SYNC_POS_ROT_CREQ, playerDto_CREQ);
        Dispatch(AreaCode.NET, 0, socketMsg);
    }
예제 #15
0
    /// <summary>
    /// 注册按钮的点击事件处理
    /// </summary>
    private void registClick()
    {
        if (string.IsNullOrEmpty(inputAccount.text))
        {
            promptMsg.Change("注册的用户名不能为空!", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
            return;
        }
        if (string.IsNullOrEmpty(inputPassword.text) ||
            inputPassword.text.Length < 4 ||
            inputPassword.text.Length > 16)
        {
            promptMsg.Change("注册的密码不合法!", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
            return;
        }
        if (string.IsNullOrEmpty(inputRepeat.text) ||
            inputRepeat.text != inputPassword.text)
        {
            promptMsg.Change("请确保两次输入的密码一致!", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
            return;
        }

        AccountDto dto = new AccountDto(inputAccount.text, inputPassword.text);

        socketMsg.Change(OpCode.ACCOUNT, AccountCode.REGIST_CREQ, dto);
        Dispatch(AreaCode.NET, 0, socketMsg);
    }
예제 #16
0
    void BtnRegistClick()
    {
        if (string.IsNullOrEmpty(id.text))
        {
            promptMsg.ChangeText("账号不能为空", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPTA_ANIM, promptMsg);
            return;
        }

        if (string.IsNullOrEmpty(password.text))
        {
            promptMsg.ChangeText("密码不能为空", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPTA_ANIM, promptMsg);
            return;
        }
        if (string.IsNullOrEmpty(repeat.text) || repeat.text != password.text)
        {
            promptMsg.ChangeText("账号密码不一致", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPTA_ANIM, promptMsg);
            return;
        }

        AccountDto dto = new AccountDto(id.text, password.text);

        socketMsg.Change(OpCode.ACCOUNT, AccountCode.REGIST_CREQ, dto);
        Dispatch(AreaCode.NET, 0, socketMsg);


        //ClearText();
    }
예제 #17
0
    //AccountDto dto = new AccountDto();
    //SocketMsg socketMsg = new SocketMsg();

    private void OnbtnRegist()
    {
        if (string.IsNullOrEmpty(inputAccount.text))
        {
            promptMsg.Change("注册的用户名不能为空", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
            return;
        }
        if (string.IsNullOrEmpty(inputPassword.text) || inputPassword.text.Length < 4 || inputPassword.text.Length > 16)
        {
            promptMsg.Change("注册的密码不合法", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
            return;
        }
        if (string.IsNullOrEmpty(inputRepeat.text) || inputRepeat.text != inputPassword.text)
        {
            promptMsg.Change("请确保两次输入的密码一致", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
            return;
        }

        AccountDto dto = new AccountDto(inputAccount.text, inputPassword.text);

        socketMsg.Change(OpCode.ACCOUNT, AccountCode.REGIST_CREQ, dto);
        //dto.Account = inputAccount.text;
        //dto.Password = inputPassword.text;
        //socketMsg.OpCode = OpCode.ACCOUNT;
        //socketMsg.SubCode = AccountCode.REGIST_CREQ;
        //socketMsg.Value = dto;

        Dispatch(AreaCode.NET, 0, socketMsg);
    }
예제 #18
0
    private void LoginBtnOnClick()
    {
        string acc = accountTxt.text;
        string pwd = pwdTxt.text;

        //输入校验
        if (string.IsNullOrEmpty(acc))
        {
            promptMsg.Change("账号不能为空", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_PANEL_SHOW, promptMsg);
            return;
        }
        if (string.IsNullOrEmpty(pwd))
        {
            promptMsg.Change("密码不能为空", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_PANEL_SHOW, promptMsg);
            return;
        }
        if (pwd.Length < 4 || pwd.Length > 16)
        {
            promptMsg.Change("密码长度不合法", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_PANEL_SHOW, promptMsg);
            return;
        }

        AccountDto accountDto = new AccountDto(acc, pwd);

        msg.Change(OpCode.ACCOUNT, AccountSubCode.LOGIN_CREQ, accountDto);
        Dispatch(AreaCode.NET, NetEvent.SENDMSG, msg);
    }
예제 #19
0
    /// <summary>
    /// 登录按钮的点击事件处理
    /// </summary>
    private void loginClick()
    {
        if (string.IsNullOrEmpty(usernameInput.text))
        {
            promptMsg.Change("登录的用户名不能为空!", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
            return;
        }
        if (string.IsNullOrEmpty(passwordInput.text))
        {
            promptMsg.Change("登录的密码不能为空!", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
            return;
        }

        if (passwordInput.text.Length < 4 || passwordInput.text.Length > 16)
        {
            promptMsg.Change("登录的密码长度不合法,应该在4-16个字符之内!", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
            return;
        }

        UserDto dto = new UserDto(usernameInput.text, passwordInput.text);

        socketMsg.Change(OpCode.User, UserCode.LOGIN, dto);
        Dispatch(AreaCode.NET, 0, socketMsg);

        //本地记录用户的相关信息
        PlayerPrefs.SetString("username", usernameInput.text);
        PlayerPrefs.SetString("password", passwordInput.text);
    }
예제 #20
0
    /// <summary>
    /// 登录按钮的点击事件处理
    /// </summary>
    private void loginClick()
    {
        // 若用户名输入为空
        if (string.IsNullOrEmpty(inputAccount.text))
        {
            promptMsg.Change("用户名输入为空", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
            return;
        }
        // 若密码输入为空
        if (string.IsNullOrEmpty(inputPassword.text))
        {
            promptMsg.Change("密码输入为空", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
            return;
        }
        // 若密码输入不是4到16位
        if (inputPassword.text.Length < 4 ||
            inputPassword.text.Length > 16)
        {
            promptMsg.Change("密码输入不是4到16位", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
            return;
        }

        //需要和服务器交互了
        AccountDto dto = new AccountDto(inputAccount.text, inputPassword.text);

        socketMsg.Change(OpCode.ACCOUNT, AccountCode.LOGIN, dto);
        Dispatch(AreaCode.NET, 0, socketMsg);
    }
예제 #21
0
 private void CreateResponse(int result)
 {
     if (result == -1)
     {
         promptMsg.Change("Illegal Login", Color.red);
         Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
         //TODO 应该强制跳转到登录界面或退出游戏
     }
     else if (result == -2)
     {
         promptMsg.Change("Repeat Create User", Color.red);
         Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
         //TODO 重复创建应该关闭创建面板
     }
     else if (result == -3)
     {
         promptMsg.Change("Name Is Exist", Color.red);
         Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
     }
     if (result == 0)
     {
         //create successfully
         Dispatch(AreaCode.UI, UIEvent.CREATE_PANEL_ACTIVE, false);
         socketmsg.Change(OpCode.USER, UserCode.GET_INFO_CREQ, null);
         Dispatch(AreaCode.NET, 0, socketmsg);
     }
 }
예제 #22
0
 /// <summary>
 /// 商会请求加入消息
 /// </summary>
 /// <param name="msg"></param>
 /// <returns></returns>
 public SocketMsg <ReqCommerceInfo> ReqComeCommerceMsg(object msg)
 {
     if (msg == null || msg.Equals(""))
     {
         //TODO提示
         promptMsg.Change("null", Color.white);
         return(null);
     }
     reqCommerceInfo.Change(null, null, msg.ToString(), null, null);
     //t.Add("commerce_name");
     //t.Add("username", PlayerPrefs.GetString("username"));
     //t.Add("token",PlayerPrefs.GetString("token"));
     messageData.Change("consumer/tree", "commerce_in", reqCommerceInfo);
     socketMsg.Change(LoginInfo.ClientId, "商会请求加入消息", messageData);
     return(socketMsg);
 }
예제 #23
0
    /// <summary>
    /// 注册按钮的点击事件处理
    /// </summary>
    private void RegisterClick()
    {
        if (string.IsNullOrEmpty(usernameInput.text))
        {
            promptMsg.Change("注册的用户名不能为空!", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
            return;
        }
        if (string.IsNullOrEmpty(passwordInput.text) ||
            passwordInput.text.Length < 4 ||
            passwordInput.text.Length > 16)
        {
            promptMsg.Change("注册的密码不合法!", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
            return;
        }
        if (string.IsNullOrEmpty(repasswordInput.text) ||
            repasswordInput.text != passwordInput.text)
        {
            promptMsg.Change("请确保两次输入的密码一致!", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
            return;
        }

        //UserDto dto = new UserDto(usernameInput.text, passwordInput.text);
        socketMsg.Change(OpCode.User, UserCode.REGIST_CREQ, dto);
        dto.username      = usernameInput.text;
        dto.password      = passwordInput.text;
        socketMsg.OpCode  = OpCode.User;
        socketMsg.SubCode = UserCode.REGIST_CREQ;
        socketMsg.Value   = dto;
        Dispatch(AreaCode.NET, 0, socketMsg);
    }
예제 #24
0
    void LoginClick()
    {
        if (string.IsNullOrEmpty(inputAccount.text))
        {
            promptMsg.Change("用户名不能为空", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
            Debug.Log("帐号不能为空!");
            return;
        }
        if (string.IsNullOrEmpty(inputPsaaword.text))
        {
            promptMsg.Change("密码不能为空", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
            Debug.Log("密码不能为空");
            return;
        }
        if (inputPsaaword.text.Length < 4 || inputPsaaword.text.Length > 16)
        {
            promptMsg.Change("密码长度应该在4-16位之间", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
            Debug.Log("密码长度应该在4-16位之间");
            return;
        }

        AccountDto dto = new AccountDto(inputAccount.text, inputPsaaword.text);

        socketMsg.Change(OpCode.ACCOUNT, AccountCode.LOGIN, dto);
        Dispatch(AreaCode.NET, 0, socketMsg);
    }
예제 #25
0
    /// <summary>
    /// 创建角色回应
    /// </summary>
    /// <param name="result"></param>
    private void CreateResponce(int result)
    {
        switch (result)
        {
        case 0:
            // 创建成功
            // 隐藏创建面板
            Dispatch(AreaCode.UI, UIEvent.CREATE_PANEL_ACTIVE, false);
            // 获取角色信息
            socketMsg.Change(OpCode.USER, UserCode.GET_INFO_CREQ, null);
            Dispatch(AreaCode.NET, 0, socketMsg);
            break;

        case -1:
            // 客户端非法登录
            Debug.LogError("客户端非法登录");
            break;

        case -2:
            // 已经有角色 重复创建
            Debug.LogError("已经有角色 重复创建");
            break;

        default:
            break;
        }
    }
예제 #26
0
 /// <summary>
 /// 创建角色的响应
 /// </summary>
 /// <param name="result"></param>
 private void CreateResponse(int result)
 {
     if (result == -1)
     {
         promptMsg.Change("角色当前非法登录!", Color.red);
         Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
         //TODO 应该强制跳转到登录界面或退出游戏
     }
     else if (result == -2)
     {
         promptMsg.Change("重复创建角色", Color.red);
         Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
         //TODO 重复创建应该关闭创建面板
     }
     else if (result == -3)
     {
         promptMsg.Change("名字已被使用", Color.red);
         Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
     }
     else if (result == 0)
     {
         //创建成功
         Dispatch(AreaCode.UI, UIEvent.CREATE_PANEL_ACTIVE, false);
         socketMsg.Change(OpCode.USER, UserCode.GET_INFO_CREQ, null);
         Dispatch(AreaCode.NET, 0, socketMsg);
     }
 }
예제 #27
0
    public void RegistClick()
    {
        if (string.IsNullOrEmpty(inputAcc.text))
        {
            promptMsg.Change("Account cannot be empty !", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
            return;
        }
        if (string.IsNullOrEmpty(inputPwd.text) || string.IsNullOrEmpty(inputPwd2.text))
        {
            promptMsg.Change("Password cannot be empty !", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
            return;
        }
        if (inputPwd.text.Length < 4 || inputPwd.text.Length > 16)
        {
            promptMsg.Change("Password is invalid !", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
            return;
        }
        if ((inputPwd2.text != inputPwd.text))
        {
            promptMsg.Change("The two passwords you typed do not match", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
            return;
        }

        AccountDto dto = new AccountDto(inputAcc.text, inputPwd.text);

        socketMsg.Change(OpCode.ACCOUNT, AccountCode.REGIST_CREQ, dto);
        Dispatch(AreaCode.NET, 0, socketMsg);
        CloseClick();
    }
예제 #28
0
    public void Login()
    {
        if (string.IsNullOrEmpty(inputAccount.text))
        {
            promptMsg.Change("Username cannot be empty!", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
            return;
        }
        if (string.IsNullOrEmpty(inputPassword.text))
        {
            promptMsg.Change("Password cannot be empty!", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
            return;
        }
        if (inputPassword.text.Length < 4 || inputPassword.text.Length > 16)
        {
            promptMsg.Change("Password is invalid", Color.red);
            Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg);
            return;
        }

        AccountDto dto = new AccountDto(inputAccount.text, inputPassword.text);

        socketMsg.Change(OpCode.ACCOUNT, AccountCode.LOGIN, dto);
        Dispatch(AreaCode.NET, 0, socketMsg);
    }
예제 #29
0
    private void matchBtnClicker()
    {
        //向服务器发送匹配请求
        socketMsg.Change(OpCode.MATCH, MatchCode.ENTER_CREQ, "发起匹配请求");
        Dispatch(AreoCode.NET, NetEvent.SENDMSG, socketMsg);

        //isShow = !isShow;
        isShow = true;
        setObjectActive(true);
        if (isShow == false)
        {
            Button_Enter.gameObject.SetActive(false);
        }

        //setObjectActive(isShow);
    }
예제 #30
0
    private void cancelClick()
    {
        //向服务器发起离开匹配的请求
        socketMsg.Change(OpCode.MATCH, MatchCode.LEAVE_CREQ, null);
        Dispatch(AreaCode.NET, 0, socketMsg);

        setPanelActive(false);
    }