コード例 #1
0
    public void DoLogin()
    {
        WaitingView.Show("Đang đăng nhập");
        LoginRequest loginRequest = new LoginRequest();

        if (string.IsNullOrEmpty(GameManager.Instance.accessToken))
        {
            loginRequest.Password = GameManager.Instance.passwordLogin;
        }

        loginRequest.UserName = GameManager.Instance.userNameLogin;

        if (!string.IsNullOrEmpty(GameManager.Instance.accessToken))
        {
            loginRequest.EsObject = Utility.SetEsObject(null, new object[] {
                "isLogin2Phase", true,
                "accessToken", GameManager.Instance.accessToken
            });
        }
        else
        {
            loginRequest.EsObject = Utility.SetEsObject(null, new object[] {
                "isLogin2Phase", true,
            });
        }

        DoRequest(loginRequest);
    }
コード例 #2
0
    private void DoCreateGame(int betting, int timePlay)
    {
        WaitingView.Show("Đang tạo phòng");
        int rulePlaying = 0;

        Debug.Log("DoCreateGame");
        EsObject gameConfig = new EsObject();

        string roomName = txtRoomName.value;

        if (string.IsNullOrEmpty(roomName))
        {
            roomName = "Bàn chơi của " + GameManager.Instance.mInfo.username;
        }

        gameConfig.setString(LobbyChan.DEFINE_LOBBY_NAME, roomName);
        gameConfig.setString(LobbyChan.DEFINE_LOBBY_PASWORD, txtPassword.value.Trim());
        gameConfig.setInteger(LobbyChan.DEFINE_BETTING, betting);

        if (!cbGaNhai.value && !cbNuoiGa.value)
        {
            showGa = (int)LobbyChan.EGaRule.none;
        }

        gameConfig.setInteger(LobbyChan.DEFINE_USING_NUOI_GA, showGa);    //true nuoi ga false ga nhai
        gameConfig.setBoolean(LobbyChan.DEFINE_USING_AUTO_BAT_BAO, true); //true
        gameConfig.setBoolean(LobbyChan.DEFINE_USING_AUTO_U, true);       //true
        rulePlaying = ruleMain[0].value ? 1 : ruleMain[1].value ? 2 : ruleMain[2].value ? 3 : 1;
        gameConfig.setInteger(LobbyChan.DEFINE_RULE_FULL_PLAYING, rulePlaying);
        gameConfig.setStringArray(LobbyChan.DEFINE_INVITED_USERS, new string[0]);
        gameConfig.setInteger(LobbyChan.DEFINE_PLAY_ACTION_TIME, timePlay);// defalt 20s

        GameManager.Server.DoRequestPlugin(Utility.SetEsObject(Fields.RESPONSE.CREATE_GAME,
                                                               new object[] { "config", gameConfig }));
    }
コード例 #3
0
    void OnClickCreate(GameObject go)
    {
        int numBetting = 0;

        for (int i = 0; i < betting.Length; i++)
        {
            if (betting[i] == null)
            {
                continue;
            }

            if (betting[i].value == true && ((ChannelPhom)GameManager.Instance.selectedChannel).bettingValues[i] == ChannelPhom.CHANNEL_BILLIONAIRE_BETTING_OTHER_VALUE)
            {
                numBetting = Convert.ToInt32(txtBetting.value) * 10000;
                break;
            }
            else if (betting[i].value)
            {
                numBetting = ((ChannelPhom)GameManager.Instance.selectedChannel).bettingValues[i];
            }
        }
        if (GameManager.Instance.mInfo.chip < numBetting * CommonPhom.RULE_CHIP_COMPARE_BETTING || numBetting < 0)
        {
            NotificationView.ShowMessage("Mức tiền cược phải nhỏ hơn " + CommonPhom.RULE_CHIP_COMPARE_BETTING + " lần số chip của bạn, hoặc mức cược đang nhỏ hơn 0", 3f);
        }
        else
        {
            WaitingView.Show("Đang tạo bàn");
            DoCreateGame(numBetting);
        }
    }
コード例 #4
0
    void Awake()
    {
        CUIHandle.AddClick(btCreateRoom, CLickButtonCreate);
        CUIHandle.AddClick(btQuickplay, ClickButtonQuick);
        CUIHandle.AddClick(btFilter, OnClickButtonFilter);
        GameManager.Server.EventPluginMessageOnProcess += OnProcessPluginMessage;
        GameManager.Server.EventJoinRoom      += OnAfterJoinRoom;
        GameManager.Server.EventPublicMessage += OnPublicMessage;
        GameManager.Server.EventLoadSence     += OnJoinGame;
        //GameManager.Instance.applicationStart.EventLoadAnnounce += OnLoadAnnounceDone;
        GameManager.Server.EventAdsChanged += CallBackAdsChangeHandler;
        //BroadcastView.Instance.ShowInLobby(GameManager.Setting.BroadcastMessage);

        Debug.Log("Channel selected:" + GameManager.Instance.selectedChannel.roomId + "," + GameManager.Instance.selectedChannel.zoneId);;
        Debug.Log("Channel chan:" + GameManager.Instance.channelRoom.roomId + "," + GameManager.Instance.channelRoom.zoneId);

        HeaderMenu.Instance.OnClickButtonBackCallBack = delegate()
        {
            WaitingView.Show("Đang thoát");
            Debug.Log("Channel current selected:" + GameManager.Instance.channelRoom.roomId + "," + GameManager.Instance.channelRoom.zoneId);
            GameManager.Server.DoJoinRoom(GameManager.Instance.channelRoom.zoneId, GameManager.Instance.channelRoom.roomId);
        };
        // get name channel
        showNameChannel();
        controller.OnTabbarSelectEvent += OnTabbarSelectHandler;
        containerFilter.GetComponent <LobbyFilter>().FilterCallBack       += FilterHandler;
        containerFilter.GetComponent <LobbyFilter>().CancelFilterCallBack += CancelFilterHandler;
    }
コード例 #5
0
    private void DoCreateGame(int betting)
    {
        WaitingView.Show("Đang tạo bàn");
        Debug.Log("DoCreateGame");
        EsObject gameConfig = new EsObject();

        string roomName = txtRoomName.value;

        if (string.IsNullOrEmpty(roomName))
        {
            roomName = "Bàn chơi của " + GameManager.Instance.mInfo.username;
        }

        gameConfig.setInteger(LobbyTLMN.DEFINE_GAME_TYPE_TLMN,
                              ruleMain[0].value ? (int)LobbyTLMN.GameConfig.GameTypeLTMN.DEM_LA : (int)LobbyTLMN.GameConfig.GameTypeLTMN.XEP_HANG);

        gameConfig.setString(LobbyTLMN.DEFINE_LOBBY_NAME, roomName);
        gameConfig.setString(LobbyTLMN.DEFINE_LOBBY_PASWORD, txtPassword.value.Trim());
        gameConfig.setInteger(LobbyTLMN.DEFINE_BETTING, betting);

        gameConfig.setBoolean(LobbyTLMN.DEFINE_USING_CHATCHONG_RULE, ruleSub[0].value);

        gameConfig.setBoolean(LobbyTLMN.DEFINE_USING_TYPE_RULE, ruleMain[0].value);//True Cơ bản, False Nâng Cao

        gameConfig.setStringArray(LobbyTLMN.DEFINE_INVITED_USERS, new string[0]);

        GameManager.Server.DoRequestPlugin(Utility.SetEsObject(Fields.RESPONSE.CREATE_GAME,
                                                               new object[] { "config", gameConfig }));
    }
コード例 #6
0
    void Start()
    {
        this.SetData();
        InitCountDownTime();

        if (GameManager.Instance.currentTournamentInfo.isRegister)
        {
            NGUITools.SetActive(TableTournament, true);
            NGUITools.SetActive(RegisterForm, false);
            WaitingView.Show("Đang lấy dữ liệu");
            GameManager.Server.DoRequestPlugin(Utility.SetEsObject(Fields.REQUEST.COMMAND_GETGENERAL,
                                                                   new object[] { "id", this.tournamentInfo.tournamentId }));
        }
        else
        {
            if (GameManager.Instance.currentTournamentInfo.remainStartTime > 0)
            {
                NGUITools.SetActive(TableTournament, false);
                NGUITools.SetActive(RegisterForm, true);
            }
            else
            {
                NGUITools.SetActive(TableTournament, true);
                NGUITools.SetActive(RegisterForm, false);
                WaitingView.Show("Đang lấy dữ liệu");
                GameManager.Server.DoRequestPlugin(Utility.SetEsObject(Fields.REQUEST.COMMAND_GETGENERAL,
                                                                       new object[] { "id", this.tournamentInfo.tournamentId }));
            }
        }
    }
コード例 #7
0
ファイル: LobbyRow.cs プロジェクト: wefasdfaew2/GamePortal
 void ProcessInputPassword(string inputDialog)
 {
     if (PlaySameDevice.IsCanJoinGameplay)
     {
         WaitingView.Show("Đang vào phòng");
         GameManager.Server.DoJoinGame(inputDialog.Trim());
     }
 }
コード例 #8
0
 void onLoginExitoso(string message)
 {
     WaitingView.Show("Đang đăng nhập");
     if (onLogin != null)
     {
         onLogin(true, JsonMapper.ToObject(message));
     }
 }
コード例 #9
0
 public void RegisterHeaderMenu()
 {
     HeaderMenu.Instance.OnClickButtonBackCallBack = delegate()
     {
         WaitingView.Show("Đang thoát");
         GameManager.Instance.currentTournamentInfo = null;
         GameManager.Server.DoJoinRoom(GameManager.Instance.channelRoom.zoneId, GameManager.Instance.channelRoom.roomId);
     };
 }
コード例 #10
0
 void OnShowDetail(GameObject obj)
 {
     if (tableId > 0)
     {
         WaitingView.Show("Vui lòng đợi");
         GameManager.Server.DoRequestPlugin(Utility.SetEsObject(Fields.REQUEST.COMMAND_MATCH_LIST,
                                                                new object[] { "groupId", tableId, "tournamentId", GameManager.Instance.currentTournamentInfo.tournamentId }));
     }
 }
コード例 #11
0
 void OnClick()
 {
     WaitingView.Show("Đang vào phòng");
     GameManager.Instance.hallRoom.gameId = this.info.gameId;
     GameManager.Server.DoRequestPlugin(Utility.SetEsObject("getLevel", new object[] {
         "appId", GameManager.Instance.hallRoom.gameId
     }));
     GameManager.Server.DoJoinRoom(info.zoneId, info.roomId);
 }
コード例 #12
0
    public void Execute()
    {
        WaitingView.Show("Chờ xử lý");
        AttributeRechargeCard attribute = Utility.EnumUtility.GetAttribute <AttributeRechargeCard>(model.ETypeCard);

        ServerWeb.StartThread(ServerWeb.URL_SEND_RECHARGE, new object[] { "username", GameManager.Instance.mInfo.username, "txtSoSeri", serial.value, "txtSoPin",
                                                                          cardCode.value, "select_method", attribute.text_id }, ProcessAfterRecharge);
        flag = false;
    }
コード例 #13
0
    public override void OnSelectTabbarAtIndex(int index)
    {
        if (tabbarPanel [index].gameObject.GetComponent <ProfileTabInfo> () != null)
        {
            tabbarPanel [index].gameObject.GetComponent <ProfileTabInfo> ().initUserInfo();
        }
        else if (tabbarPanel [index].gameObject.GetComponent <ProfileTabSettingView> () != null)
        {
            tabbarPanel [index].gameObject.GetComponent <ProfileTabSettingView> ().initInformation();
        }
        else if (tabbarPanel [index].gameObject.GetComponent <ProfileTabMessageView> () != null)
        {
            tabbarPanel[index].gameObject.GetComponent <ProfileTabMessageView>().gridMessageSystem.Reposition();
            tabbarPanel[index].gameObject.GetComponent <ProfileTabMessageView>().gridInvited.Reposition();
            tabbarPanel[index].gameObject.GetComponent <ProfileTabMessageView>().gridFriend.Reposition();

            if (!hadRequestMessage && GameManager.Instance.mInfo.messages.Count == 0)
            {
                WaitingView.Show("Đang tải dữ liệu");
                if (!hadRequestMessage)
                {
                    GameManager.Server.DoRequestCommand(Fields.REQUEST.GET_MESSAGE);
                    hadRequestMessage = true;
                }

                if (!hadRequestBuddies)
                {
                    hadRequestBuddies = true;
                    GameManager.Server.DoRequestCommand(Fields.REQUEST.GET_BUDDIES);
                }
            }
            else
            {
                if (StoreGame.Contains(StoreGame.EType.SEND_FRIEND_MESSAGE))
                {
                    tabbarPanel[index].gameObject.GetComponent <ProfileTabMessageView>().OnResponseMessageHandler();
                }
                else
                {
                    tabbarPanel[index].gameObject.GetComponent <ProfileTabMessageView>().reLoadListMessageFriendWhenSelectTabMessage();
                }
            }

            numberTabMessage.gameObject.SetActive(index != 1);
        }
        else if (tabbarPanel [index].gameObject.GetComponent <ProfileTabFriend> () != null)
        {
            tabbarPanel[index].gameObject.GetComponent <ProfileTabFriend>().tableFriend.Reposition();
            if (!hadRequestBuddies && GameManager.Instance.mInfo.buddies.Count == 0)
            {
                WaitingView.Show("Đang tải dữ liệu");
                hadRequestBuddies = true;
                GameManager.Server.DoRequestCommand(Fields.REQUEST.GET_BUDDIES);
            }
        }
    }
コード例 #14
0
 void OnRegister(GameObject obj)
 {
     if (!cbPolicy.value)
     {
         NotificationView.ShowMessage("Bạn phải đồng ý với điều khoản!");
         return;
     }
     WaitingView.Show("Đăng đăng ký");
     GameManager.Server.DoRequestPlugin(Utility.SetEsObject(Fields.REQUEST.COMMAND_REGISTERTOURNAMENT,
                                                            new object[] { "id", tournamentInfo.tournamentId }));
 }
コード例 #15
0
ファイル: LogViewer.cs プロジェクト: wefasdfaew2/GamePortal
    /// <summary>
    /// Logged messages are sent through this callback function.
    /// </summary>
    /// <param name="message">The message itself.</param>
    /// <param name="stackTrace">A trace of where the message came from.</param>
    /// <param name="type">The type of message: error/exception, warning, or assert.</param>
    void HandleLog(string message, string stackTrace, LogType type)
    {
        ConsoleMessage entry = new ConsoleMessage(message, stackTrace, type);

        entries.Add(entry);
        if (entries.Count > LIMIT_LINE)
        {
            entries.RemoveAt(0);
        }

        if (GameManager.CurrentScene == ESceneName.GameplayChan && type == LogType.Exception)
        {
            WaitingView.Show("Có l?i x?y ra. Vui lòng d?i!");
            GameManager.Server.DoRequestGameCommand("refreshGame");
        }


        entriesConsole.Add(entry);
        if (entriesConsole.Count > LIMIT_LINE_CONSOLE)
        {
            entriesConsole.RemoveAt(0);
        }

        if (type == LogType.Error && !message.StartsWith("Coroutine couldn't be started because the the game object"))
        {
            StoreGame.ClearLog();
            for (int i = 0; i < entries.Count; i++)
            {
                StoreGame.SaveLog(StoreGame.EType.DEBUG_LOG, entries[i].message);
            }
            //SaveLogToFile(); //for test
            string  url  = ServerWeb.URL_REQUEST_ERROR;
            string  data = ConvertStringToJson(StoreGame.LoadString(StoreGame.EType.DEBUG_LOG));
            WWWForm form = new WWWForm();
            form.AddField("app_id", GameManager.GAME.ToString());
            form.AddField("game_version", GameSettings.CurrentVersion);
            if (GameManager.CurrentScene != ESceneName.LoginScreen)
            {
                form.AddField("user_id", GameManager.Instance.mInfo.id);
                form.AddField("username", GameManager.Instance.mInfo.username);
            }
            form.AddField("scene", GameManager.CurrentScene.ToString());
            form.AddField("error", "");
            form.AddField("detail", "");
            form.AddField("environment", Common.GetDevice);
            form.AddField("debug_log", data);
            form.AddField(ServerWeb.PARAM_PARTNER_ID, GameSettings.Instance.ParnerCodeIdentifier);
            if (!listSendError.Contains(form))
            {
                listSendError.Add(form);
                ServerWeb.StartThread(url, form, null);
            }
        }
    }
コード例 #16
0
    IEnumerator _ProressAfterLoginFacebook(bool isDone, WWW textResponse, IDictionary json)
    {
        if (isDone)
        {
            WaitingView.Hide();
            switch (json["code"].ToString())
            {
            case "1":
                WaitingView.Show("Đang đăng nhập");
                GameManager.Instance.accessToken   = json["accessToken"].ToString();
                GameManager.Instance.userNameLogin = json["username"].ToString();
                GameManager.Server.DoLogin();
                break;

            case "-1":
                reLoginFaceBook();
                break;

            case "-2":
                if (Application.isWebPlayer)
                {
                    GameManager.Instance.UpdateCookieString();
                    while (GameManager.Instance.Cookie.Length == 0)
                    {
                        yield return(new WaitForEndOfFrame());
                    }
                    string[] arr = GameManager.Instance.Cookie.Split(';');
                    Array.ForEach(arr, c => { if (c.Contains("PHPSESSID"))
                                              {
                                                  cookie = c;
                                              }
                                  });
                }
                else
                {
                    cookie = textResponse.responseHeaders[ServerWeb.PHP_COOKIE];
                }
                if (GameObject.Find("LoginScreen Code") != null)
                {
                    GameObject.Find("LoginScreen Code").gameObject.GetComponent <LoginScreenView>().formRegister.GetComponent <RegisterView>().SessionId       = cookie;
                    GameObject.Find("LoginScreen Code").gameObject.GetComponent <LoginScreenView>().formRegister.GetComponent <RegisterView>().iUsername.value = json["suggestUser"].ToString();
                    if (GameObject.Find("LoginScreen Code").gameObject.GetComponent <LoginScreenView>().IsFormRegisterHide)
                    {
                        GameObject.Find("LoginScreen Code").gameObject.GetComponent <LoginScreenView>().ShowFormRegister();
                    }
                }
                //RegisterView.Create(cookie, json["suggestUser"].ToString());
                break;
            }
        }
    }
コード例 #17
0
    void _ChangeInformation()
    {
        //string[] array = txtFullname.value.Split(" ".ToCharArray(), StringSplitOptions.None);
        string[] array = txtFullname.value.Trim().Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);

        User user = GameManager.Instance.mInfo;

        user.firstName = user.lastName = user.middleName = "";
        if (array.Length > 2)
        {
            user.lastName   = array[0];
            user.firstName  = array[array.Length - 1];
            user.middleName = "";
            for (int i = 1; i < array.Length - 1; i++)
            {
                user.middleName += array[i] + " ";
            }
        }
        else if (array.Length == 1)
        {
            user.firstName = array[0];
        }
        else if (array.Length == 2)
        {
            user.lastName  = array[0];
            user.firstName = array[array.Length - 1];
        }

        string birthday = txtDay.value + "/" + txtMonth.value + "/" + txtYear.value;

        user.brithday = Utility.Convert.StringToTime(birthday, "vi-VN");
        user.address  = txtAddress.value;
        user.gender   = cbMale.value ? "male" : "female";
        String json = convertUserInfoToJson(user);

        WWWForm form = new WWWForm();

        form.AddField(ServerWeb.PARAM_TYPE, ServerWeb.TYPE_CHANGE_INFO);
        form.AddField(ServerWeb.PARAM_DATA, json);
        form.AddField(ServerWeb.PARAM_PARTNER_ID, GameSettings.Instance.ParnerCodeIdentifier);
        WaitingView.Show("Đang lưu thông tin");
        ServerWeb.StartThread(ServerWeb.URL_CHANGE_INFORMATION, form, ProcessAfterChangeInformation);
    }
コード例 #18
0
    private void reLoginFaceBook()
    {
        WaitingView.Show("Đang lấy thông tin từ Facebook");
#if UNITY_WEBPLAYER
        FacebookWeb.login("email,publish_actions,publish_stream");
#else
        CallLogin();
#endif

        //#if UNITY_ANDROID
        //        FacebookAndroid.logout();
        //        FacebookAndroid.loginWithPublishPermissions(FB_PERMISSION);
        //#elif UNITY_IPHONE
        //		FacebookBinding.logout();
        //		FacebookBinding.loginWithReadPermissions(FB_PERMISSION);

        //        WaitingView.Show("Chờ phản hồi từ Facebook");
        //        FacebookWeb.login("email,publish_actions,publish_stream");
        //#endif
    }
コード例 #19
0
    void Awake()
    {
        CUIHandle.AddClick(imageAds.GetComponent <CUIHandle>(), OnClickAds);
        CUIHandle.AddClick(btCreateRoom, CLickButtonCreate);
        CUIHandle.AddClick(btQuickplay, ClickButtonQuick);

        GameManager.Server.EventPluginMessageOnProcess += OnProcessPluginMessage;
        GameManager.Server.EventJoinRoom      += OnAfterJoinRoom;
        GameManager.Server.EventLoadSence     += OnJoinGame;
        GameManager.Server.EventPublicMessage += OnPublicMessage;
        GameManager.Instance.applicationStart.EventLoadAnnounce += OnLoadAnnounceDone;

        HeaderMenu.Instance.ReDraw();
        HeaderMenu.Instance.OnClickButtonBackCallBack = delegate()
        {
            WaitingView.Show("Đang thoát");
            Debug.Log("Channel current selected:" + GameManager.Instance.channelRoom.roomId + "," + GameManager.Instance.channelRoom.zoneId);
            GameManager.Server.DoJoinRoom(GameManager.Instance.channelRoom.zoneId, GameManager.Instance.channelRoom.roomId);
        };
    }
コード例 #20
0
    void Awake()
    {
        this.tournamentInfo = GameManager.Instance.currentTournamentInfo;
        CUIHandle.AddClick(btnRegister, OnRegister);
        CUIHandle.AddClick(btnBack, OnClickBack);
        GameManager.Server.EventPluginMessageOnProcess += OnProcessPluginMessage;
        GameManager.Server.EventJoinRoom += OnAfterJoinRoom;

        if (GameManager.CurrentScene == ESceneName.Tournament)
        {
            HeaderMenu.Instance.OnClickButtonBackCallBack = delegate()
            {
                WaitingView.Show("Đang thoát");
                GameManager.Instance.currentTournamentInfo = null;
                GameManager.Server.DoJoinRoom(GameManager.Instance.currentRoomGiaiDau.zoneId, GameManager.Instance.currentRoomGiaiDau.roomId);
            };
        }

        GameManager.Instance.displayTournamentMenu = true;
        HeaderMenu.Instance.ReDraw();
    }
コード例 #21
0
    IEnumerator _DoConnection(CallBackFunction callback)
    {
        //Đặt biến không cho gửi kết nối nữa.
        mustThreadConnecting = true;

        es.Engine.Queueing = EsEngine.QueueDispatchType.External;
        Server server = new Server(CServer.SERVER_ID);

        //if (es.Engine.Servers.Contains(server) == false)
        server.AddAvailableConnection(new AvailableConnection(CServer.HOST_NAME, System.Convert.ToInt32(CServer.PORT), TYPE_CONNECT));
        es.Engine.AddServer(server);

        log4net.Config.BasicConfigurator.Configure();

#if UNITY_WEBPLAYER
        if (!Application.isEditor && Application.isWebPlayer)
        {
            if (!Security.PrefetchSocketPolicy(CServer.HOST_NAME, System.Convert.ToInt32(CServer.PORT), 999))
            {
                Debug.LogError("Security Exception. Policy file load failed!");
            }
        }
#endif

        //Set là chưa có thông tin phản hồi về kết nối
        bool?connectionResponseSuccessful = null;

        WaitingView.Show("Kết nối đến máy chủ");

        threadConnect = new System.Threading.Thread(delegate()
        {
            es.Engine.Connect();
            connectionResponseSuccessful = es.Engine.Connected;
        });
        threadConnect.Start();

        while (connectionResponseSuccessful == null)
        {
            yield return(new WaitForEndOfFrame());
        }

        if (isLogged)
        {
            WaitingView.Instance.Close();
        }

        if (!es.Engine.Connected)
        {
            WaitingView.Hide();
            NotificationView.ShowConfirm(
                "Lỗi kết nối TCP/IP.",
                "Không thể kết nối đến máy chủ.\n\n Bạn có muốn thực hiện lại hành động vừa rồi ?",
                delegate()
            {
                DoConnection(callback);
            }, null);
        }
        else
        {
            callback();
        }
        mustThreadConnecting = false;
    }
コード例 #22
0
    IEnumerator Start()
    {
        Debug.Log(GameManager.Setting.IsMustUpdate);

        if (!Common.IsRelease)
        {
            CServer.HOST_NAME = StoreGame.LoadString(StoreGame.EType.SAVE_SERVER);
        }

        if (!string.IsNullOrEmpty(GameManager.Setting.IsMustUpdate))
        {
            NotificationView.ShowConfirm("Thông báo", "Có bản cập nhật quan trọng. Bạn có muốn tải về?", OnOkUpdateVersion, OnCancelUpdateVersion);
            yield break;
        }
        else
        {
            if (Common.IsRelease && GameManager.Instance.currentRoom != null)
            {
#if UNITY_WEBPLAYER
                switch (GameSettings.Instance.TypeBuildFor)
                {
                case GameSettings.EBuildType.esimo:
                case GameSettings.EBuildType.web_esimo:
                    //UpdateCookieString();
                    //StartCoroutine(_LoginInWebPlayer());
                    break;

                case GameSettings.EBuildType.web_facebook:
                    while (string.IsNullOrEmpty(CServer.HOST_NAME))
                    {
                        yield return(new WaitForEndOfFrame());
                    }
                    WaitingView.Show("Đang lấy thông tin");
                    SocialCommon.Instance.LoginFaceBook(cbSavePass.value);
                    break;
                }
#endif
                GameManager.Instance.userNameLogin = StoreGame.Contains(StoreGame.EType.SAVE_USERNAME) ? StoreGame.LoadString(StoreGame.EType.SAVE_USERNAME) : "";
                GameManager.Instance.passwordLogin = StoreGame.Contains(StoreGame.EType.SAVE_PASSWORD) ? StoreGame.LoadString(StoreGame.EType.SAVE_PASSWORD) : "";
                if (!string.IsNullOrEmpty(GameManager.Instance.userNameLogin) && !string.IsNullOrEmpty(GameManager.Instance.passwordLogin))
                {
                    while (string.IsNullOrEmpty(CServer.HOST_NAME))
                    {
                        yield return(new WaitForEndOfFrame());
                    }
                    yield return(new WaitForSeconds(0.1f));

                    WaitingView.Show("Đang đăng nhập");
                    GameManager.Server.DoLogin();
                }
            }
            else if (Common.IsRelease)
            {
                if (StoreGame.Contains(StoreGame.EType.SAVE_USERNAME) && StoreGame.Contains(StoreGame.EType.SAVE_PASSWORD))
                {
                    if (!string.IsNullOrEmpty(StoreGame.LoadString(StoreGame.EType.SAVE_USERNAME)) && !string.IsNullOrEmpty(StoreGame.LoadString(StoreGame.EType.SAVE_PASSWORD)))
                    {
                        lableUsername.value = StoreGame.LoadString(StoreGame.EType.SAVE_USERNAME);
                        lablePassword.value = StoreGame.LoadString(StoreGame.EType.SAVE_PASSWORD);
                    }
                }
            }
        }
        AudioManager.Instance.PlayBackground();
    }
コード例 #23
0
 // Use this for initialization
 void Start()
 {
     WaitingView.Show("Đang lấy dữ liệu. Vui lòng đợi");
     GameManager.Server.DoRequestCommand(Fields.REQUEST.COMMAND_TOURNAMENT);
     gridTournament.GetComponent <UICenterOnChild>().onCenter = ShowDetail;
 }
コード例 #24
0
    IEnumerator DoRequestAllConfiguration(string message)
    {
        int getConfigurationCount = 0;

        WaitingView.Show(message);
        bool?   reRequest = null;
        WWWForm form      = new WWWForm();

        form.AddField(ServerWeb.PARAM_CONFIG_CODE_GAME, GameManager.GAME.ToString());
        form.AddField(ServerWeb.PARAM_CONFIG_CODE_PLATFORM, PlatformSetting.GetPlatform.ToString());
        form.AddField(ServerWeb.PARAM_CONFIG_CORE_VERSION, GameSettings.Instance.CORE_VERSION);
        form.AddField(ServerWeb.PARAM_CONFIG_BUILD_VERSION, GameSettings.Instance.BUILD_VERSION);
        form.AddField(ServerWeb.PARAM_CONFIG_CODE_REVISION, GameSettings.Instance.CODE_VERSION_BUILD);
        form.AddField(ServerWeb.PARAM_PARTNER_ID, GameSettings.Instance.ParnerCodeIdentifier);
        ServerWeb.StartThreadHttp(ServerWeb.URL_GET_ALL_CONFIGURATION, form, delegate(bool isDone, WWW response, IDictionary json)
        {
            if (isDone)
            {
                GameManager.Instance.FunctionDelay(delegate()
                {
                    if (string.IsNullOrEmpty(response.error))
                    {
                        WaitingView.Instance.Close();
                        reRequest = false;
                        if (json[Fields.RESPONSE.PHP_RESPONSE_CODE].ToString() == "0")
                        {
                            ArrayList items = (ArrayList)json[Fields.RESPONSE.PHP_RESPONSE_ITEMS];
                            foreach (Hashtable obj in items)
                            {
                                GameManager.Setting.Platform.AddOrUpdatePlatformConfig(obj);
                            }
                            if (GameManager.CurrentScene == ESceneName.ChannelChan)
                            {
                                //HeaderMenu.Instance.ActiveButtonRecharge();
                            }
                            if (GameManager.Setting.Platform.GetConfigByType(PlatformType.url_ping) != null)
                            {
                                ServerWeb.URL_PING = GameManager.Setting.Platform.GetConfigByType(PlatformType.url_ping).Value;
                            }

                            if (GameManager.Setting.Platform.GetConfigByType(PlatformType.realtime_server) != null)
                            {
                                CServer.HOST_NAME = GameManager.Setting.Platform.GetConfigByType(PlatformType.realtime_server).Value;
                            }

                            if (EventLoadConfig != null)
                            {
                                EventLoadConfig();
                            }
                        }
                    }
                    else
                    {
                        reRequest = true;
                    }
                }, 0.2f);
            }
        });
        while (reRequest == null)
        {
            yield return(new WaitForEndOfFrame());
        }
        if (reRequest == true)
        {
            getConfigurationCount++;
            if (getConfigurationCount < 3)
            {
                yield return(new WaitForSeconds(1f));

                GameManager.Instance.StartCoroutine(DoRequestAllConfiguration("Kết nối bị lỗi , Đang kiểm tra lại kết nối "));
            }
            else
            {
                NotificationView.ShowConfirm("Thông báo", "Không thể kết nối đến server của chúng tôi . Bấm đồng ý để tiếp tục kiểm tra lại ", delegate()
                {
                    getConfigurationCount = 0;
                    GameManager.Instance.StartCoroutine(DoRequestAllConfiguration("Kiểm tra kết nối đến server"));
                }, null);
            }
        }
    }