Esempio n. 1
0
    // Token: 0x06001D3F RID: 7487 RVA: 0x00347630 File Offset: 0x00345830
    public void OnButtonClick(UIButton sender)
    {
        if (this.bInput && !this.InputCheck && sender.m_BtnID1 == 6)
        {
            this.OpenInputCheck(true);
            this.mInput.enabled = false;
            return;
        }
        switch (sender.m_BtnID1)
        {
        case 0:
            if (this.door != null)
            {
                this.door.CloseMenu(false);
            }
            break;

        case 1:
            if (DataManager.MapDataController.CheckKingFunction(eKingFunction.eAnnouncement))
            {
                if (this.text_Input1.text.Length == 0 || this.text_Input1.text == this.DM.mStringTable.GetStringByID(1446u))
                {
                    this.GUIM.AddHUDMessage(this.DM.mStringTable.GetStringByID(1447u), 255, true);
                }
                else
                {
                    GUIManager.Instance.OpenSpendWindow_Normal(this, this.DM.mStringTable.GetStringByID(1445u), this.DM.mStringTable.GetStringByID(1450u), 200, 0, 0, this.DM.mStringTable.GetStringByID(1451u), false);
                }
            }
            break;

        case 2:
            if (DataManager.MapDataController.CheckKingFunction(eKingFunction.eAnnouncement))
            {
                this.mInput.enabled = true;
                this.mInput.ActivateInputField();
                this.bInput = true;
                this.KingdomT.gameObject.SetActive(false);
            }
            break;

        case 3:
            if (DataManager.MapDataController.CheckKingFunction(eKingFunction.eAnnouncement))
            {
                this.mInput.enabled = true;
                this.mInput.ActivateInputField();
                this.bInput = true;
                this.KingdomT.gameObject.SetActive(false);
                this.EditT.gameObject.SetActive(false);
            }
            break;

        case 4:
            if (DataManager.MapDataController.CheckKingFunction(eKingFunction.eAnnouncement))
            {
                if (this.text_Input1.text.Length == 0 || this.text_Input1.text == this.DM.mStringTable.GetStringByID(1446u))
                {
                    this.GUIM.AddHUDMessage(this.DM.mStringTable.GetStringByID(1447u), 255, true);
                }
                else
                {
                    this.DM.SendModifyKingdomBullitin(this.mInput.text);
                }
            }
            break;

        case 5:
            this.mInput.enabled = false;
            this.OpenInputCheck(false);
            this.bInput = false;
            this.KingdomT.gameObject.SetActive(true);
            this.mInput.text = StringManager.InputTemp;
            if (this.DM.mKingdomClassifieds != string.Empty)
            {
                this.mInput.text = this.DM.mKingdomClassifieds;
            }
            else
            {
                this.mInput.text = string.Empty;
            }
            break;

        case 7:
            if (this.DM.bNeedTranslateClassifieds && !this.DM.bTranslateClassifieds && !this.DM.bWaitTranslateClassifieds)
            {
                this.btn_Translation.gameObject.SetActive(false);
                this.Img_Translate.gameObject.SetActive(true);
                this.DM.bWaitTranslateClassifieds = true;
                IGGSDKPlugin.Translate_KA(this.DM.mKingdomClassifieds);
            }
            else
            {
                if (!this.bShowTranslate)
                {
                    this.mInput.text                      = StringManager.InputTemp;
                    this.mInput.text                      = this.DM.mKingdomClassifieds;
                    this.text_Translation.text            = this.DM.mStringTable.GetStringByID(9052u);
                    this.bShowTranslate                   = true;
                    this.text_Input1.resizeTextForBestFit = false;
                }
                else
                {
                    this.mInput.text          = StringManager.InputTemp;
                    this.mInput.text          = IGGGameSDK.Instance.TranslateStringOut_KA.ToString();
                    this.text_InputCheck.text = IGGGameSDK.Instance.TranslateStringOut_KA.ToString();
                    this.text_InputCheck.SetAllDirty();
                    this.text_InputCheck.cachedTextGenerator.Invalidate();
                    this.text_InputCheck.cachedTextGeneratorForLayout.Invalidate();
                    if (this.text_InputCheck.preferredHeight > 320f)
                    {
                        this.text_Input1.resizeTextForBestFit = true;
                        this.text_Input1.resizeTextMaxSize    = 17;
                        this.text_Input1.resizeTextMinSize    = 10;
                        this.text_Input1.text = IGGGameSDK.Instance.TranslateStringOut_KA.ToString();
                        this.text_Input1.SetAllDirty();
                        this.text_Input1.cachedTextGenerator.Invalidate();
                        this.text_Input1.cachedTextGeneratorForLayout.Invalidate();
                    }
                    this.Cstr_Translation.ClearString();
                    this.Cstr_Translation.StringToFormat(IGGGameSDK.Instance.GetLanguageStringID((byte)this.DM.mKingdomClassifieds_L));
                    this.Cstr_Translation.AppendFormat(this.DM.mStringTable.GetStringByID(9054u));
                    this.text_Translation.text = this.Cstr_Translation.ToString();
                    this.bShowTranslate        = false;
                }
                this.text_Translation.SetAllDirty();
                this.text_Translation.cachedTextGenerator.Invalidate();
                this.text_Translation.cachedTextGeneratorForLayout.Invalidate();
                if (this.text_Translation.preferredWidth > this.text_Translation.rectTransform.sizeDelta.x)
                {
                    this.text_Translation.rectTransform.sizeDelta = new Vector2(this.text_Translation.preferredWidth + 2f, this.text_Translation.rectTransform.sizeDelta.y);
                }
                if (this.GUIM.IsArabic)
                {
                    this.text_Translation.UpdateArabicPos();
                }
            }
            break;

        case 8:
            this.GUIM.OpenMessageBoxEX(this.DM.mStringTable.GetStringByID(1444u), this.DM.mStringTable.GetStringByID(1477u), null, null, 0, 0, true, true);
            break;
        }
    }