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);
         }
     }
 }
    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
                    {
                    });
                });
            }
        }
    }
 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);
 }
Beispiel #4
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);
 }
    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);
    }