public GameSceneEvent(GameSceneEvent e)
 {
     isExecute = e.isExecute;
     eventName = e.eventName;
     sender    = e.sender;
     userData  = e.userData;
 }
    private void Update()
    {
        if (isObserve)
        {
            if ((!IsValidParty() || !IsConnect()) && !queryInvalidRoom)
            {
                if (!checkInviteListDone)
                {
                    if (MonoBehaviourSingleton <UserInfoManager> .I.ExistsPartyInvite)
                    {
                        if (!isSendingInviteList)
                        {
                            if (!GameSceneEvent.IsStay())
                            {
                                GameSceneEvent.Stay();
                                isStayEvent = true;
                            }
                            MonoBehaviourSingleton <PartyManager> .I.SendInvitedParty(delegate
                            {
                                if (isStayEvent)
                                {
                                    GameSceneEvent.Resume(null);
                                }
                                checkInviteListDone = true;
                            }, false);

                            isSendingInviteList = true;
                        }
                    }
                    else
                    {
                        checkInviteListDone = true;
                    }
                }
                else
                {
                    string currentSectionName = MonoBehaviourSingleton <GameSceneManager> .I.GetCurrentSectionName();

                    if (section != null && section.sectionData != (GameSceneTables.SectionData)null && section.sectionData.sectionName == currentSectionName && MonoBehaviourSingleton <GameSceneManager> .I.IsEventExecutionPossible())
                    {
                        queryInvalidRoom = true;
                        if (dispatchCallBack != null)
                        {
                            dispatchCallBack("INVALID_ROOM");
                            OffObserve();
                        }
                    }
                }
            }
            else if (sendInfoSpan.IsReady())
            {
                Protocol.Try(delegate
                {
                    MonoBehaviourSingleton <PartyManager> .I.SendInfo(delegate
                    {
                    });
                });
            }
        }
    }
 public static void PopStay()
 {
     if (stayStack != null && stayStack.Count != 0)
     {
         stay = (GameSceneEvent)stayStack.Pop();
     }
 }
 public static void SendEvent(string caller, GameObject sender, string event_name, object event_data = null, Action <string, object, string> callback = null)
 {
     if (string.IsNullOrEmpty(event_name))
     {
         Log.Error(LOG.UI, "eventName == empty");
     }
     else if (MonoBehaviourSingleton <GameSceneManager> .IsValid() && !GameSceneEvent.IsStay())
     {
         if (MonoBehaviourSingleton <GameSceneManager> .I.isChangeing)
         {
             UIPanel componentInParent = sender.GetComponentInParent <UIPanel>();
             if (componentInParent == null || componentInParent.depth != 9999)
             {
                 Log.Error(LOG.UI, "GameSceneManager.I.isChangeing == true");
                 return;
             }
         }
         string text = null;
         UIGameSceneEventSenderVersionRestriction component = sender.GetComponent <UIGameSceneEventSenderVersionRestriction>();
         if (component != null)
         {
             text = component.GetCheckApplicationVersionText();
         }
         if (callback == null)
         {
             MonoBehaviourSingleton <GameSceneManager> .I.ExecuteSceneEvent(caller, sender, event_name, event_data, text, true);
         }
         else
         {
             callback(event_name, event_data, text);
         }
     }
 }
Пример #5
0
 private void OpenMessageDialog(Error msg_id, Action <string> callback)
 {
     GameSceneEvent.PushStay();
     MonoBehaviourSingleton <GameSceneManager> .I.OpenCommonDialog(new CommonDialog.Desc(CommonDialog.TYPE.OK, StringTable.GetErrorMessage((uint)msg_id), null, null, null, null), delegate(string ret)
     {
         GameSceneEvent.PopStay();
         callback(ret);
     }, true, 0);
 }
Пример #6
0
 private void OpenYesNoDialog(Error msg_id, Action <string> callback)
 {
     GameSceneEvent.PushStay();
     MonoBehaviourSingleton <GameSceneManager> .I.OpenCommonDialog(new CommonDialog.Desc(CommonDialog.TYPE.YES_NO, StringTable.GetErrorMessage((uint)msg_id), StringTable.Get(STRING_CATEGORY.COMMON_DIALOG, 110u), StringTable.Get(STRING_CATEGORY.COMMON_DIALOG, 112u), null, null), delegate(string ret)
     {
         GameSceneEvent.PopStay();
         callback(ret);
     }, true, 0);
 }
 public static void PushStay()
 {
     if (stayStack == null)
     {
         stayStack = new Stack();
     }
     stayStack.Push(stay);
     stay = null;
 }
 public static void Stay()
 {
     if (stay != null)
     {
         Log.Error(LOG.GAMESCENE, "ERR :: GameSceneEvent Is Already Staying");
     }
     else
     {
         stay = new GameSceneEvent(current);
         ResetCurrent();
     }
 }
 public static void Resume(object userData = null)
 {
     if (stay != null && MonoBehaviourSingleton <GameSceneManager> .IsValid())
     {
         current = stay;
         stay    = null;
         if (userData != null)
         {
             current.userData = userData;
         }
         MonoBehaviourSingleton <GameSceneManager> .I.ExecuteSceneEvent("GameSceneEvent.Resume", current.sender, current.eventName, current.userData, null, false);
     }
 }
Пример #10
0
 private static void OpenMaintenancePopup <T>(T ret) where T : BaseModel
 {
     GameSceneEvent.PushStay();
     MonoBehaviourSingleton <GameSceneManager> .I.OpenCommonDialog(new CommonDialog.Desc(CommonDialog.TYPE.YES_NO, StringTable.GetErrorMessage(1002u), StringTable.Get(STRING_CATEGORY.ERROR_DIALOG, 100202u), StringTable.Get(STRING_CATEGORY.ERROR_DIALOG, 100201u), null, ret.infoError), delegate(string btn)
     {
         if (btn == "YES")
         {
             Native.OpenURL("https://www.facebook.com/DragonProject/");
         }
         GameSceneEvent.PopStay();
         MonoBehaviourSingleton <AppMain> .I.Reset();
         Native.applicationQuit();
     }, true, ret.error);
 }
 public override void OnQuery_SELECT_ROOM()
 {
     if (GameSceneEvent.current != null)
     {
         object userData = GameSceneEvent.current.userData;
         if (userData != null)
         {
             StringBuilder stringBuilder = new StringBuilder();
             stringBuilder.Append(MonoBehaviourSingleton <PartyManager> .I.partys[(int)userData].partyNumber);
             stringBuilder.Append("_");
             stringBuilder.Append(PartyManager.GenerateToken());
             PlayerPrefs.SetString("im", stringBuilder.ToString());
         }
     }
     GameSceneEvent.Cancel();
     BackToHome();
 }
Пример #12
0
    protected static void ResumeEvent(bool is_resume, object userData = null)
    {
        if (is_resume)
        {
            GameSceneEvent.Resume(userData);
        }
        else
        {
            GameSceneEvent.Cancel();
            GameSection currentSection = MonoBehaviourSingleton <GameSceneManager> .I.GetCurrentSection();

            if (currentSection != null && currentSection.isClose)
            {
                currentSection.Open(UITransition.TYPE.OPEN);
            }
        }
    }
Пример #13
0
 private static bool IsEnabledSend()
 {
     if (!AppMain.isInitialized)
     {
         return(true);
     }
     if (!MonoBehaviourSingleton <UIManager> .I.IsDisable())
     {
         if (!isTry && !GameSceneEvent.IsStay())
         {
             return(false);
         }
     }
     else if (!GameSceneEvent.IsStay() && !MonoBehaviourSingleton <GameSceneManager> .I.isWaiting)
     {
         return(false);
     }
     return(true);
 }
Пример #14
0
 public bool IsEnableControl()
 {
     if (MonoBehaviourSingleton <GameSceneManager> .I.isChangeing)
     {
         return(false);
     }
     if (GameSceneEvent.IsStay())
     {
         return(false);
     }
     if (isPlayingSitAnimation)
     {
         return(false);
     }
     if (MonoBehaviourSingleton <GameSceneManager> .I.GetCurrentSectionName() != "HomeTop" && MonoBehaviourSingleton <GameSceneManager> .I.GetCurrentSectionName() != "LoungeTop" && MonoBehaviourSingleton <GameSceneManager> .I.GetCurrentSectionName() != "GuildTop")
     {
         return(false);
     }
     return(true);
 }
 public static void Initialize()
 {
     ResetCurrent();
     stay      = null;
     stayStack = null;
 }
Пример #16
0
 protected static void StayEvent()
 {
     GameSceneEvent.Stay();
 }
Пример #17
0
 protected static void PopStayEvent()
 {
     GameSceneEvent.PopStay();
 }
Пример #18
0
 protected static void ChangeStayEvent(string event_name, object event_data = null)
 {
     GameSceneEvent.ChangeStay(event_name, event_data);
 }
Пример #19
0
    private static bool End <T>(T ret, Action <T> call_back, Action retry_action) where T : BaseModel
    {
        SetBusy(-1);
        int  code = ret.error;
        bool flag = MonoBehaviourSingleton <UIManager> .IsValid() && MonoBehaviourSingleton <UIManager> .I.IsTutorialErrorResend();

        if (code == 0)
        {
            if (flag)
            {
                GameSceneEvent.PopStay();
            }
            if (Utility.IsExist(ret.diff) && MonoBehaviourSingleton <ProtocolManager> .IsValid())
            {
                MonoBehaviourSingleton <ProtocolManager> .I.OnDiff(ret.diff[0]);
            }
            return(true);
        }
        if (code < 100000)
        {
            bool flag2 = false;
            switch (code)
            {
            case 1002:
            case 1003:
            case 1020:
            case 1023:
            case 2001:
                flag2 = true;
                break;
            }
            if ((!flag2 || ret is CheckRegisterModel) && GameSceneGlobalSettings.IsNonPopupError(ret))
            {
                if (code == 1002)
                {
                    OpenMaintenancePopup(ret);
                }
                return(true);
            }
            string errorMessage = StringTable.GetErrorMessage((uint)code);
            MonoBehaviourSingleton <GoWrapManager> .I.trackEvent("error_code_" + code, "Error");

            if (flag2 && code != 1002)
            {
                GameSceneEvent.PushStay();
                MonoBehaviourSingleton <GameSceneManager> .I.OpenCommonDialog(new CommonDialog.Desc(CommonDialog.TYPE.YES_NO, errorMessage, null, null, null, null), delegate
                {
                    GameSceneEvent.PopStay();
                    if (code == 1003)
                    {
                        Native.launchMyselfMarket();
                    }
                    MonoBehaviourSingleton <AppMain> .I.Reset();
                }, true, code);
            }
            else if (flag2 && code == 1002)
            {
                OpenMaintenancePopup(ret);
            }
            else if (!MonoBehaviourSingleton <GameSceneManager> .I.isChangeing && !flag)
            {
                GameSceneEvent.PushStay();
                MonoBehaviourSingleton <GameSceneManager> .I.OpenCommonDialog(new CommonDialog.Desc(CommonDialog.TYPE.OK, errorMessage, null, null, null, null), delegate
                {
                    GameSceneEvent.PopStay();
                    call_back(ret);
                    if (code == 74001 || code == 74002)
                    {
                        Debug.Log((object)"kciked");
                        MonoBehaviourSingleton <AppMain> .I.ChangeScene(string.Empty, "HomeTop", delegate
                        {
                            MonoBehaviourSingleton <GuildManager> .I.UpdateGuild(null);
                        });
                    }
                }, true, code);
            }
            else
            {
                if (flag && GameSceneEvent.IsStay())
                {
                    GameSceneEvent.PushStay();
                }
                if (code == 74001 || code == 74002)
                {
                    MonoBehaviourSingleton <GameSceneManager> .I.OpenCommonDialog(new CommonDialog.Desc(CommonDialog.TYPE.OK, errorMessage, null, null, null, null), delegate
                    {
                        GameSceneEvent.PopStay();
                        call_back(ret);
                        if (code == 74001 || code == 74002)
                        {
                            MonoBehaviourSingleton <AppMain> .I.Reset();
                        }
                    }, true, code);
                }
                else
                {
                    MonoBehaviourSingleton <GameSceneManager> .I.OpenCommonDialog(new CommonDialog.Desc(CommonDialog.TYPE.YES_NO, errorMessage, StringTable.Get(STRING_CATEGORY.COMMON_DIALOG, 110u), StringTable.Get(STRING_CATEGORY.COMMON_DIALOG, 111u), null, null), delegate(string btn)
                    {
                        if (btn == "YES")
                        {
                            retry_action();
                        }
                        else
                        {
                            MonoBehaviourSingleton <AppMain> .I.Reset();
                        }
                    }, true, code);
                }
            }
            return(false);
        }
        if (code == 200000)
        {
            MonoBehaviourSingleton <GoWrapManager> .I.trackEvent("error_200000", "Functionality");
        }
        else
        {
            MonoBehaviourSingleton <GoWrapManager> .I.trackEvent("error_code_" + code, "Error");
        }
        string text = StringTable.Format(STRING_CATEGORY.COMMON_DIALOG, 1001u, code);

        GameSceneEvent.PushStay();
        if (code == 129903)
        {
            text = StringTable.Format(STRING_CATEGORY.ERROR_DIALOG, 72003u, code);
            MonoBehaviourSingleton <GameSceneManager> .I.OpenCommonDialog(new CommonDialog.Desc(CommonDialog.TYPE.OK, text, null, null, null, null), delegate
            {
                GameSceneEvent.PopStay();
                call_back(ret);
            }, true, code);
        }
        else if (code > 500000 && code < 600000)
        {
            text = StringTable.Format(STRING_CATEGORY.ERROR_DIALOG, (uint)code, code);
            MonoBehaviourSingleton <GameSceneManager> .I.OpenCommonDialog(new CommonDialog.Desc(CommonDialog.TYPE.OK, text, null, null, null, null), delegate
            {
                GameSceneEvent.PopStay();
                call_back(ret);
            }, true, code);
        }
        else if (code > 600000 && code < 700000)
        {
            text = StringTable.Format(STRING_CATEGORY.ERROR_DIALOG, (uint)code, code);
            MonoBehaviourSingleton <GameSceneManager> .I.OpenCommonDialog(new CommonDialog.Desc(CommonDialog.TYPE.YES_NO, text, StringTable.Get(STRING_CATEGORY.COMMON_DIALOG, 110u), StringTable.Get(STRING_CATEGORY.COMMON_DIALOG, 111u), null, null), delegate(string btn)
            {
                GameSceneEvent.PopStay();
                if (btn == "YES")
                {
                    retry_action();
                }
                else
                {
                    MonoBehaviourSingleton <AppMain> .I.Reset();
                }
            }, true, code);
        }
        else
        {
            MonoBehaviourSingleton <GameSceneManager> .I.OpenCommonDialog(new CommonDialog.Desc(CommonDialog.TYPE.YES_NO, text, StringTable.Get(STRING_CATEGORY.COMMON_DIALOG, 110u), StringTable.Get(STRING_CATEGORY.COMMON_DIALOG, 111u), null, null), delegate(string btn)
            {
                GameSceneEvent.PopStay();
                if (btn == "YES")
                {
                    retry_action();
                }
                else
                {
                    MonoBehaviourSingleton <AppMain> .I.Reset();
                }
            }, true, code);
        }
        return(false);
    }
Пример #20
0
    public void SendCheckRegister(string ntc_data, Action <bool> call_back)
    {
        CheckRegisterModel.RequestSendForm requestSendForm = new CheckRegisterModel.RequestSendForm();
        requestSendForm.data = ntc_data;
        Protocol.Send(CheckRegisterModel.URL, requestSendForm, delegate(CheckRegisterModel ret)
        {
            switch (ret.Error)
            {
            case Error.None:
                MonoBehaviourSingleton <UserInfoManager> .I.SetRecvUserInfo(ret.result.userInfo, ret.result.tutorialStep);
                MonoBehaviourSingleton <UserInfoManager> .I.SetNewsID(ret.result.newsId);
                MonoBehaviourSingleton <UserInfoManager> .I.userIdHash = ret.result.userIdHash;
                sendAsset = ret.result.sendAsset;
                if (ret.result.recommendUpdate)
                {
                    RecommendUpdateCheck(delegate
                    {
                        call_back(true);
                    });
                }
                else if (call_back != null)
                {
                    call_back(true);
                }
                break;

            case Error.ERR_AUTH_FAILED:
                if (string.IsNullOrEmpty(account.token))
                {
                    if (ret.result.recommendUpdate)
                    {
                        RecommendUpdateCheck(delegate
                        {
                            call_back(false);
                        });
                    }
                    else if (call_back != null)
                    {
                        call_back(false);
                    }
                }
                else
                {
                    MonoBehaviourSingleton <GameSceneManager> .I.OpenCommonDialog(new CommonDialog.Desc(CommonDialog.TYPE.YES_NO, StringTable.GetErrorMessage((uint)ret.Error), StringTable.Get(STRING_CATEGORY.COMMON_DIALOG, 101u), StringTable.Get(STRING_CATEGORY.COMMON_DIALOG, 102u), null, null), delegate(string btn)
                    {
                        if (btn == "YES")
                        {
                            GameSceneEvent.PopStay();
                            ResetAccount();
                            TutorialReadData.SaveAsEmptyData();
                            SaveAsEmptyData();
                            MonoBehaviourSingleton <AppMain> .I.Reset();
                        }
                        else
                        {
                            SendCheckRegister(ntc_data, call_back);
                        }
                    }, true, (int)ret.Error);
                }
                break;

            case Error.WRN_MAINTENANCE:
                OpenMessageDialog(ret.Error, delegate
                {
                    MonoBehaviourSingleton <GameSceneManager> .I.OpenInfoDialog(delegate
                    {
                        SendCheckRegister(ntc_data, call_back);
                    }, true);
                });
                break;

            case Error.WRN_UPDATE_FORCE:
                OpenMessageDialog(ret.Error, delegate
                {
                    Native.launchMyselfMarket();
                    SendCheckRegister(ntc_data, call_back);
                });
                break;

            case Error.WRN_BAN_USER:
                OpenMessageDialog(ret.Error, delegate
                {
                    SendCheckRegister(ntc_data, call_back);
                });
                break;

            case Error.WRN_RESIGNED_USER:
                OpenMessageDialog(ret.Error, delegate
                {
                    SendCheckRegister(ntc_data, call_back);
                });
                break;

            default:
                OpenYesNoDialog(ret.Error, delegate(string sel)
                {
                    if ("YES" == sel)
                    {
                        SendCheckRegister(ntc_data, call_back);
                    }
                    else
                    {
                        Application.Quit();
                    }
                });
                break;
            }
        }, string.Empty);
    }
Пример #21
0
 protected static void CancelEventAndBackSection()
 {
     GameSceneEvent.Cancel();
     MonoBehaviourSingleton <GameSceneManager> .I.ChangeSectionBack();
 }
 public static void Cancel()
 {
     ResetCurrent();
     stay = null;
 }
Пример #23
0
 protected static void ChangeStayEventData(object event_data)
 {
     GameSceneEvent.ChangeStayEventData(event_data);
 }