예제 #1
0
    private void OnReciveRandomPVP(EventData eventData)
    {
        byte[] rolesData  = (byte[])eventData[(byte)ParameterCode.BattleRoles];
        byte[] battleData = (byte[])eventData[(byte)ParameterCode.BattleData];

        GameManager.battleTime = (float)eventData[(byte)ParameterCode.BattleTime];

        GameBattle gameBattle = Serialization.Load <GameBattle>(battleData);

        GameManager.battleType = gameBattle.Mode;

        if (gameBattle.User01.Id != GameManager.GameUser.Id)
        {
            GameManager.EnemyUser         = gameBattle.User01;
            GameManager.GameUser.Position = gameBattle.User02.Position;
        }
        else
        {
            GameManager.GameUser.Position = gameBattle.User01.Position;
            GameManager.EnemyUser         = gameBattle.User02;
        }

        GameObjCollection battleRoles = Serialization.Load <GameObjCollection>(rolesData, true);

        GameplayManager.InitRoles(battleRoles);

        MessageBox.CloseDialog();


        GameManager.Status = GameStatus.PVP;

        //GameplayManager.isBattleStart = false;

        _uiManager.OnReciveBattleInfo();
    }
예제 #2
0
    //check current step of tutorial and to world map scene
    public void OnPhotonLoginSuccess()
    {
        GameManager.tutorial.Init();
        MessageBox.CloseDialog();
        GameManager.logined = true;
        GameScenes.ChangeScense(GameScenes.MyScene.MainMenu, GameScenes.MyScene.WorldMap);

        if (Application.platform == RuntimePlatform.WindowsWebPlayer || Application.platform == RuntimePlatform.OSXWebPlayer)
        {
        }
        else
        {
            PlayerPrefs.SetString("UsernameLOL", txtLogin_UserName.value);

            string pass = txtLogin_Password.value;
            pass = Helper.Encrypt(pass, false);
            PlayerPrefs.SetString("PassWordLOL", pass);
        }
    }
예제 #3
0
    public void OnButtonOkClick()
    {
        if (OnButtonOK_click != null)
        {
            OnButtonOK_click.Invoke();
        }

        if (OnButtonOK_click != null)
        {
            OnButtonOK_click -= OnButtonOK_click;
        }

        if (OnButtonCancel_click != null)
        {
            OnButtonCancel_click -= OnButtonCancel_click;
        }

        tweenScale.duration = tweenScale.duration / 2;
        MessageBox.CloseDialog(_id);
    }
예제 #4
0
    //event network
    public override void OnResponse(OperationResponse response)
    {
        base.OnResponse(response);
        MessageBox.CloseDialog();
        OperationCode opCode  = (OperationCode)response.OperationCode;
        ErrorCode     errCode = (ErrorCode)response.ReturnCode;

        if (errCode != ErrorCode.Success)
        {
            Debug.Log(string.Format("ResponseReceived, OperationCode = {0}, ReturnCode = {1}, DebugMsg = {2}", opCode, errCode, response.DebugMessage));

            if (errCode == ErrorCode.DuplicateLogin)
            {
                _uiLoginManager.OnResponeDuplicate();
            }
            else
            {
                this.HandleErrorCode(errCode);
            }

            return;
        }

        switch (opCode)
        {
        case OperationCode.Register:
            _uiLoginManager.OnRegisterSuccess();
            break;

        case OperationCode.SignIn:

            //Login succecss
            OnSignIn(response);
            break;

        //load zone list from master to login
        case OperationCode.ZonesList:
            OnZonesList(response);
            break;
        }
    }
예제 #5
0
    public void OnBuyItemResponse(ErrorCode errorCode)
    {
        Debug.Log("OnBuyItemResponse " + errorCode);
        MessageBox.CloseDialog();


        lblNotification.text = GameManager.localization.GetText("Shop_Success");
        setGoldSivler();

        if (!_isBuyHero)
        {
            //  UserItem itemBuy = GameManager.GameUser.UserItems[GameManager.GameUser.UserItems.Count - 1];
            //  Debug.Log("itemBuy" + itemBuy);
            //  uiItemReview.gameObject.SetActive(true);
            // uiInformationIcon.GetComponent<UIInformationItemManager>().SetItem(itemBuy);
            MessageBox.ShowDialog(GameManager.localization.GetText("Shop_Success"), UINoticeManager.NoticeType.Message);
        }
        else
        {
            UserRole roleBuy = GameManager.GameUser.UserRoles[GameManager.GameUser.UserRoles.Count - 1];
            randomHeroRoot.OnResponseFromServer(roleBuy);
        }
    }
예제 #6
0
    public override void OnResponse(OperationResponse response)
    {
        base.OnResponse(response);

        OperationCode             opCode    = (OperationCode)response.OperationCode;
        ErrorCode                 errCode   = (ErrorCode)response.ReturnCode;
        Dictionary <byte, object> parameter = response.Parameters;

        if (errCode != ErrorCode.Success)
        {
            this.HandleErrorCode(errCode);
            Debug.Log(string.Format("ResponseReceived, OperationCode = {0}, ReturnCode = {1}, DebugMsg = {2}", opCode, errCode, response.DebugMessage));

            if (errCode == ErrorCode.TargetNotFound)
            {
                MessageBox.CloseDialog();
                MessageBox.ShowDialog(GameManager.localization.GetText("Social_FindUser_UserNotFound"), UINoticeManager.NoticeType.Message);
            }

            return;
        }

        switch (opCode)
        {
        case OperationCode.UserUpdate:
        {
            SubCode subCode = (SubCode)parameter[(byte)ParameterCode.SubCode];

            switch (subCode)
            {
            case SubCode.CheckReport:
                HandleReponseCheckReport(response);
                break;

            case SubCode.ReadEmail:
                HandleReponseReadMail(response);
                break;

            case SubCode.CheckEmail:
                this.HandleReponseCheckMail(response);
                _manager.OnResponseCheckMail();
                break;

            case SubCode.GetFriend:
                this.HandleReponseGetFriendList(response);
                _manager.OnResponseFriendList();
                break;

            case SubCode.AddFriend:
                if (errCode == ErrorCode.Success)
                {
                    HandleReponseAddFriend(response);
                }
                else
                {
                    MessageBox.CloseDialog();
                    MessageBox.ShowDialog(GameManager.localization.GetText("Social_FindUser_UserNotFound"), UINoticeManager.NoticeType.Message);
                }
                break;
            }
        }
        break;

        default: break;
        }
    }
 public void OnResponseZoneList()
 {
     MessageBox.CloseDialog();
     GameScenes.ChangeScense(GameScenes.MyScene.Login, GameScenes.MyScene.Zone);
 }
예제 #8
0
    public static void HandleBattle(this PhotonController controller, EventData eventData, GameStatus type)
    {
        SubCode subCode = (SubCode)eventData[(byte)ParameterCode.SubCode];

        //Debug.Log("subCode " + subCode);
        switch (subCode)
        {
        case SubCode.Invite:
        {
            //int senderID = (int)eventData[(byte)ParameterCode.UserId];

            //GameUser inviterBattle = (GameUser)GameManager.ZoneUsers[senderID];
            //UIInviterManager.Instance.AddInviter(inviterBattle);
        }
        break;

        case SubCode.Refuse:
        {
            MessageBox.CloseDialog();
            MessageBox.ShowDialog(GameManager.localization.GetText("Dialog_Refuse"), UINoticeManager.NoticeType.Message);
        }
        break;

        case SubCode.Begin:
        {
            GameplayManager.battleStatus = GameplayManager.BattleStatus.Start;

            byte[] rolesData  = (byte[])eventData[(byte)ParameterCode.BattleRoles];
            byte[] battleData = (byte[])eventData[(byte)ParameterCode.BattleData];

            battleTime = (float)eventData[(byte)ParameterCode.BattleTime];



            GameBattle gameBattle = Serialization.Load <GameBattle>(battleData);


            if (gameBattle.User01.Id != GameManager.GameUser.Id)
            {
                GameManager.EnemyUser         = gameBattle.User01;
                GameManager.GameUser.Position = gameBattle.User02.Position;
            }
            else
            {
                GameManager.GameUser.Position = gameBattle.User01.Position;
                GameManager.EnemyUser         = gameBattle.User02;
            }

            GameObjCollection battleRoles = Serialization.Load <GameObjCollection>(rolesData, true);

            GameplayManager.InitRoles(battleRoles);

            MessageBox.CloseDialog();

            GameScenes.ChangeScense(GameScenes.previousSence, GameScenes.MyScene.Battle);

            GameManager.Status = type;
            battleType         = gameBattle.Mode;
        }
        break;
        }
    }