#define USE_LOCAL_LOCALIZATION using ChatFilter; using IVDataFormat; using IVServerFormat; using System; using TMPro; using UnityEngine; using UnityEngine.Audio; using UnityEngine.UI; public class SettingMgr : MonoBehaviour { #region Const private static SettingMgr curMgr = null; #endregion Const #region Base [Header("Base")] [SerializeField] private AudioMixer amxMaster; private AudioMixerGroup amxgBgm; //private AudioMixerGroup amxgEfc; //private AudioMixerGroup amxgVoice; #endregion Base #region UI [Header("UI")] [SerializeField] private TextMeshProUGUI txtMainT; [SerializeField] private Canvas canvasUI; private ButtonIV[] btnTabs; private GameObject groupGame, groupAccountSet, groupName, groupCoupon, groupMenu, groupAccount, groupTest; private Slider[] sldSounds; private ButtonIV[] btnSwitchOns, btnSwitchOffs; private ButtonIV btnName, btnTestMod; private TextMeshProUGUI txtName, txtId; private TMP_InputField inputCoupon; private TextMeshProUGUI inputCouponPlaceHolder; private GameObject goPopupName; private TMP_InputField inputName; private GameObject goPopupLang; private Toggle[] tglLangs; private GameObject goPopupCs; [SerializeField] private Button btnTest; #endregion UI #region Variables private int iLoading = 1; private int iSelectedTab = -1; private int[] iLangs = new int[] { (int)SystemLanguage.English, (int)SystemLanguage.Korean, (int)SystemLanguage.Japanese }; private SystemLanguage selectedLang = SystemLanguage.English; #endregion Variables #region Base public static void SLocalize(bool bmain) { if (curMgr != null) curMgr.Localize(bmain); } // 번역. private void Localize(bool bmain) { if (bmain) { txtMainT.text = LocalizationText.GetText("setting_title"); } else { Transform trfcanvas = canvasUI.transform; trfcanvas.Find("txtT").GetComponent().text = LocalizationText.GetText("setting_title"); btnTabs = trfcanvas.Find("tabWrapTop").GetChild(0).GetComponentsInChildren(true); btnTabs[0].transform.Find("txt").GetComponent().text = LocalizationText.GetText("setting_game"); btnTabs[1].transform.Find("txt").GetComponent().text = LocalizationText.GetText("setting_account"); sldSounds[0].transform.parent.Find("txtT").GetComponent().text = LocalizationText.GetText("setting_bgm"); sldSounds[1].transform.parent.Find("txtT").GetComponent().text = LocalizationText.GetText("setting_efc"); sldSounds[2].transform.parent.Find("txtT").GetComponent().text = LocalizationText.GetText("setting_voice"); btnSwitchOns[0].transform.parent.GetChild(0).GetComponent().text = LocalizationText.GetText("setting_shake"); btnSwitchOns[1].transform.parent.GetChild(0).GetComponent().text = LocalizationText.GetText("setting_damage"); btnSwitchOns[2].transform.parent.GetChild(0).GetComponent().text = LocalizationText.GetText("setting_skill"); btnSwitchOns[3].transform.parent.GetChild(0).GetComponent().text = LocalizationText.GetText("setting_lowoption"); btnSwitchOns[4].transform.parent.GetChild(0).GetComponent().text = LocalizationText.GetText("setting_autosleep"); btnSwitchOns[5].transform.parent.GetChild(0).GetComponent().text = LocalizationText.GetText("setting_push"); btnSwitchOns[6].transform.parent.GetChild(0).GetComponent().text = LocalizationText.GetText("setting_pushnight"); Transform trfn = groupName.transform; trfn.Find("txtT").GetComponent().text = LocalizationText.GetText("setname_title"); btnName.transform.Find("txt").GetComponent().text = LocalizationText.GetText("setname_changebtn"); Transform trfc = groupCoupon.transform; inputCouponPlaceHolder = trfc.Find("inputCoupon").transform.Find("Placeholder").GetComponent(); inputCouponPlaceHolder.text = LocalizationText.GetText("setting_coupondesc"); trfc.Find("btnCoupon").GetChild(0).GetComponent().text = LocalizationText.GetText("setting_couponuse"); Transform trfm = groupMenu.transform; trfm.Find("btnLang").GetChild(0).GetComponent().text = LocalizationText.GetText("setting_lang"); trfm.Find("btnSave").GetChild(0).GetComponent().text = LocalizationText.GetText("setting_save"); trfm.Find("btnCS").GetChild(0).GetComponent().text = LocalizationText.GetText("setting_cs"); trfm.Find("btnReview").GetChild(0).GetComponent().text = LocalizationText.GetText("setting_review"); trfm.Find("btnCommunity").GetChild(0).GetComponent().text = LocalizationText.GetText("setting_community"); Transform trfa = groupAccount.transform; trfa.Find("btnLogout").GetChild(0).GetComponent().text = LocalizationText.GetText("all_logout"); trfa.Find("btnDeleteServer").GetChild(0).GetComponent().text = LocalizationText.GetText("setting_deleteserver"); trfa.Find("btnDeleteAccount").GetChild(0).GetComponent().text = LocalizationText.GetText("setting_deleteaccount"); Transform trfname = goPopupName.transform; trfname.Find("txtTitle").GetComponent().text = LocalizationText.GetText("setname_change"); trfname.Find("txtMsg").GetComponent().text = LocalizationText.GetText("setname_con2"); trfname.Find("inputName").GetChild(0).GetComponent().text = LocalizationText.GetText("setname_con1"); trfname.Find("btnNo").GetChild(0).GetComponent().text = LocalizationText.GetText(Global.STR_CANCEL); trfname.Find("btnYes").GetChild(0).GetComponent().text = LocalizationText.GetText("setname_changebtn"); Transform trflang = goPopupLang.transform; trflang.Find("txtT").GetComponent().text = LocalizationText.GetText("setting_lang"); trflang.Find("btnNo").GetChild(0).GetComponent().text = LocalizationText.GetText(Global.STR_CANCEL); trflang.Find("btnYes").GetChild(0).GetComponent().text = LocalizationText.GetText("all_save"); tglLangs[0].transform.Find("txt").GetComponent().text = LocalizationText.GetText("setting_langen"); tglLangs[1].transform.Find("txt").GetComponent().text = LocalizationText.GetText("setting_langko"); tglLangs[2].transform.Find("txt").GetComponent().text = LocalizationText.GetText("setting_langja"); goPopupCs.transform.Find("txtT").GetComponent().text = LocalizationText.GetText("setting_cs"); ButtonIV[] btncss = goPopupCs.transform.GetComponentsInChildren(true); btncss[0].transform.GetChild(0).GetComponent().text = LocalizationText.GetText("setting_csplay"); btncss[1].transform.GetChild(0).GetComponent().text = LocalizationText.GetText("setting_cspurchase"); btncss[2].transform.GetChild(0).GetComponent().text = LocalizationText.GetText("setting_cssugg"); btncss[3].transform.GetChild(0).GetComponent().text = LocalizationText.GetText("setting_csetc"); } } // 백버튼 처리. public static bool SCloseMenu() { return curMgr.CloseMenu(); } private bool CloseMenu() { // 게임 시작 후 열린적 없음. if (iSelectedTab < 0) return false; // 문의 팝업. if (goPopupCs.activeSelf) { CloseCs(); return true; } // 언어 팝업. if (goPopupLang.activeSelf) { CloseLang(); return true; } // 닉네임 팝업. if (goPopupName.activeSelf) { CloseName(); return true; } if (canvasUI.enabled) { CloseSetting(); return true; } return false; } private void Awake() { curMgr = this; } void Start() { QualitySettings.vSyncCount = 0; amxgBgm = amxMaster.FindMatchingGroups("Bgm")[0]; //amxgEfc = amxMaster.FindMatchingGroups("Efc")[0]; //amxgVoice = amxMaster.FindMatchingGroups("Voice")[0]; SoundMgr.SSetAmxGroupBgm(amxgBgm); LoadSettingSound(); LoadSettingView(); iLoading--; btnTest.gameObject.SetActive(TestMod); } private void Init() { Transform trfcanvas = canvasUI.transform; groupGame = trfcanvas.Find("svGame").gameObject; sldSounds = groupGame.transform.GetChild(0).GetChild(0).GetComponentsInChildren(true); ButtonIV[] btnviews = groupGame.transform.GetChild(0).GetChild(1).GetComponentsInChildren(true); btnSwitchOns = new ButtonIV[7]; btnSwitchOffs = new ButtonIV[7]; for (int i = 0; i < btnSwitchOns.Length; i++) { btnSwitchOns[i] = btnviews[i * 2]; btnSwitchOffs[i] = btnviews[i * 2 + 1]; } groupAccountSet = trfcanvas.Find("svAccount").gameObject; groupName = groupAccountSet.transform.Find("Contents").transform.Find("groupName").gameObject; txtName = groupName.transform.Find("txtName").GetComponent(); txtId = groupName.transform.Find("txtId").GetComponent(); btnName = groupName.transform.Find("btnName").GetComponent(); groupCoupon = groupAccountSet.transform.Find("Contents").transform.Find("groupCoupon").gameObject; inputCoupon = groupCoupon.transform.Find("inputCoupon").GetComponent(); groupMenu = groupAccountSet.transform.Find("Contents").transform.Find("groupMenu").gameObject; groupAccount = groupAccountSet.transform.Find("Contents").transform.Find("groupAccount").gameObject; //groupTest = trfcanvas.Find("groupTest").gameObject; goPopupName = trfcanvas.Find("goPopupName").gameObject; inputName = goPopupName.transform.Find("inputName").GetComponent(); goPopupLang = trfcanvas.Find("goPopupLang").gameObject; tglLangs = goPopupLang.transform.Find("wrapper").GetComponentsInChildren(true); goPopupCs = trfcanvas.Find("goPopupCS").gameObject; //tset btnTestMod = trfcanvas.Find("btnTestMod").GetComponent(); btnTestMod.transform.GetChild(0).gameObject.SetActive(!TestMod);//btnTestMod.transform.GetChild(0).GetComponent().enabled = !TestMod; } #endregion Base #region UI public static void SMoveSetting(eEventMoveType content) { curMgr.OpenSetting(); switch (content) { case eEventMoveType.SettingSys: curMgr.TabGame(); break; case eEventMoveType.SettingId: curMgr.TabAccount(); break; } } // 설정창 열기. public void OpenSetting() { if (iLoading > 0) return; iLoading++; canvasUI.enabled = true; if (iSelectedTab < 0) { Init(); Localize(false); SetSettingSound(); SetSettingView(); TabGame(); txtName.text = DataHandler.PlayData.playerName; txtId.text = DataHandler.PlayData.userCode; btnName.transform.Find("txtPrice").GetComponent().text = FormatString.TextInt(DataHandler.Const.nameChangePrice); } inputCoupon.text = null; GameUIMgr.SCloseMenu(); //GameUIMgr.SSetMainUiOn(false); btnName.interactable = DataHandler.Const.nameChangePrice <= (DataHandler.Goods.diaFree + DataHandler.Goods.diaPaid); SoundMgr.PlaySfx(SoundName.BtnPress); iLoading--; } // 설정창 닫기. public void CloseSetting() { if (!canvasUI.enabled) return; if (iLoading > 0) return; iLoading++; SaveSoundSettings(); canvasUI.enabled = false; //GameUIMgr.SSetMainUiOn(true); SoundMgr.PlaySfx(SoundName.BtnPress); iLoading--; } #endregion UI #region Tab public void TabGame() { if (iSelectedTab == 0) return; iSelectedTab = 0; btnTabs[0].interactable = false; btnTabs[1].interactable = true; groupGame.SetActive(true); groupAccountSet.SetActive(false); groupName.SetActive(false); groupCoupon.SetActive(false); groupMenu.SetActive(false); groupAccount.SetActive(false); SoundMgr.PlaySfx(SoundName.BtnPress); } public void TabAccount() { if (iSelectedTab == 1) return; iSelectedTab = 1; btnTabs[0].interactable = true; btnTabs[1].interactable = false; groupGame.SetActive(false); groupAccountSet.SetActive(true); groupName.SetActive(true); groupCoupon.SetActive(true); groupMenu.SetActive(true); groupAccount.SetActive(true); btnName.interactable = DataHandler.Const.nameChangePrice <= (DataHandler.Goods.diaFree + DataHandler.Goods.diaPaid); SoundMgr.PlaySfx(SoundName.BtnPress); } #endregion Tab #region Sound public static void SLoadSettingSound() { if (curMgr != null) curMgr.LoadSettingSound(); } // 저장된 사운드 설정 불러오기. private void LoadSettingSound() { float fvalue = ES3.Load(Global.ES3_BgmVol, 0.75f); amxMaster.SetFloat(Global.ES3_BgmVol, Mathf.Log10(fvalue) * 20f); SoundMgr.BgmOn = fvalue > 0.0001f; fvalue = ES3.Load(Global.ES3_EfcVol, 0.75f); amxMaster.SetFloat(Global.ES3_EfcVol, Mathf.Log10(fvalue) * 20f); SoundMgr.EfcOn = fvalue > 0.0001f; fvalue = ES3.Load(Global.ES3_VoiceVol, 0.75f); amxMaster.SetFloat(Global.ES3_VoiceVol, Mathf.Log10(fvalue) * 20f); SoundMgr.VoiceOn = fvalue > 0.0001f; } // 사운드 설정 세팅. private void SetSettingSound() { sldSounds[0].value = ES3.Load(Global.ES3_BgmVol, 0.75f); sldSounds[1].value = ES3.Load(Global.ES3_EfcVol, 0.75f); sldSounds[2].value = ES3.Load(Global.ES3_VoiceVol, 0.75f); } // 배경음 볼륨 세팅. public void OnVolBgmChange() { amxMaster.SetFloat(Global.ES3_BgmVol, Mathf.Log10(sldSounds[0].value) * 20f); if (!SoundMgr.BgmOn || sldSounds[0].value > 0.0001f) SoundMgr.BgmOn = sldSounds[0].value > 0.0001f; } // 효과음 볼륨 세팅. public void OnVolEfcChange() { amxMaster.SetFloat(Global.ES3_EfcVol, Mathf.Log10(sldSounds[1].value) * 20f); SoundMgr.EfcOn = sldSounds[1].value > 0.0001f; } // 보이스 볼륨 세팅. public void OnVolVoiceChange() { amxMaster.SetFloat(Global.ES3_VoiceVol, Mathf.Log10(sldSounds[2].value) * 20f); SoundMgr.VoiceOn = sldSounds[2].value > 0.0001f; } // 사운드 설정 저장. private void SaveSoundSettings() { SoundMgr.BgmOn = sldSounds[0].value > 0.0001f; ES3.Save(Global.ES3_BgmVol, sldSounds[0].value); ES3.Save(Global.ES3_EfcVol, sldSounds[1].value); ES3.Save(Global.ES3_VoiceVol, sldSounds[2].value); } #endregion Sound #region View private void LoadSettingView() { IVCameraController.SSetShake(ES3.Load(Global.ES3_Shake, true)); BattleMgr.SSetOnDamageText(ES3.Load(Global.ES3_DamageText, true)); BattleMgr.SSetOnSkillEffect(ES3.Load(Global.ES3_SkillEffect, true)); BattleMgr.SSetOnSkillEffect(ES3.Load(Global.ES3_LowOption, false)); SleepModeMgr.SSetAutoSleep(ES3.Load(Global.ES3_AutoSleep, true)); NotifyMgr.SetNotifiON(ES3.Load(Global.ES3_Notify, false)); NotifyMgr.SetnightNotifiON(ES3.Load(Global.ES3_NightNotify, false)); // test TestMod = ES3.Load(Global.ES3_TestMod, false); } private void SetSettingView() { bool bvalue = ES3.Load(Global.ES3_Shake, true); btnSwitchOns[0].interactable = !bvalue; btnSwitchOffs[0].interactable = bvalue; bvalue = ES3.Load(Global.ES3_DamageText, true); btnSwitchOns[1].interactable = !bvalue; btnSwitchOffs[1].interactable = bvalue; bvalue = ES3.Load(Global.ES3_SkillEffect, true); btnSwitchOns[2].interactable = !bvalue; btnSwitchOffs[2].interactable = bvalue; bvalue = ES3.Load(Global.ES3_LowOption, false); btnSwitchOns[3].interactable = !bvalue; btnSwitchOffs[3].interactable = bvalue; bvalue = ES3.Load(Global.ES3_AutoSleep, true); btnSwitchOns[4].interactable = !bvalue; btnSwitchOffs[4].interactable = bvalue; bvalue = ES3.Load(Global.ES3_Notify, true); btnSwitchOns[5].interactable = !bvalue; btnSwitchOffs[5].interactable = bvalue; bvalue = ES3.Load(Global.ES3_NightNotify, true); btnSwitchOns[6].interactable = !bvalue; btnSwitchOffs[6].interactable = bvalue; } public void SwitchShakeOn() { SwitchShake(true); } public void SwitchShakeOff() { SwitchShake(false); } // 카메라 흔들림. private void SwitchShake(bool bvalue) { SoundMgr.PlaySfx(SoundName.BtnPress); btnSwitchOns[0].interactable = !bvalue; btnSwitchOffs[0].interactable = bvalue; IVCameraController.SSetShake(bvalue); ES3.Save(Global.ES3_Shake, bvalue); } public void SwitchDamageOn() { SwitchDamage(true); } public void SwitchDamageOff() { SwitchDamage(false); } // 데미지 표시. private void SwitchDamage(bool bvalue) { btnSwitchOns[1].interactable = !bvalue; btnSwitchOffs[1].interactable = bvalue; BattleMgr.SSetOnDamageText(bvalue); ES3.Save(Global.ES3_DamageText, bvalue); SoundMgr.PlaySfx(SoundName.BtnPress); } public void SwitchSkillOn() { SwitchSkill(true); } public void SwitchSkillOff() { SwitchSkill(false); } // 스킬 이펙트 표시. private void SwitchSkill(bool bvalue) { btnSwitchOns[2].interactable = !bvalue; btnSwitchOffs[2].interactable = bvalue; BattleMgr.SSetOnSkillEffect(bvalue); ES3.Save(Global.ES3_SkillEffect, bvalue); SoundMgr.PlaySfx(SoundName.BtnPress); } public void SwitchLowOptionOn() { SwitchLowOption(true); } public void SwitchLowOptionOff() { SwitchLowOption(false); } // 저사양 모드. private void SwitchLowOption(bool bvalue) { btnSwitchOns[3].interactable = !bvalue; btnSwitchOffs[3].interactable = bvalue; if (bvalue) Application.targetFrameRate = 30; else Application.targetFrameRate = 60; ES3.Save(Global.ES3_LowOption, bvalue); SoundMgr.PlaySfx(SoundName.BtnPress); } // 자동 절전 모드 private void SwitchAutoSleep(bool bvalue) { btnSwitchOns[4].interactable = !bvalue; btnSwitchOffs[4].interactable = bvalue; SleepModeMgr.SSetAutoSleep(bvalue); ES3.Save(Global.ES3_AutoSleep, bvalue); SoundMgr.PlaySfx(SoundName.BtnPress); } public void SwitchAutoSleepOn() { SwitchAutoSleep(true); } public void SwitchAutoSleepOff() { SwitchAutoSleep(false); } private void SwitchNotify(bool bvalue) { btnSwitchOns[5].interactable = !bvalue; btnSwitchOffs[5].interactable = bvalue; NotifyMgr.SetNotifiON(bvalue); ES3.Save(Global.ES3_Notify, bvalue); SoundMgr.PlaySfx(SoundName.BtnPress); } public void SwitchNotifyOn() { SwitchNotify(true); } public void SwitchNotifyOff() { SwitchNotify(false); } public static void StartSwitchNotify(bool bvalue) { NotifyMgr.SetNotifiON(bvalue); ES3.Save(Global.ES3_Notify, bvalue); SoundMgr.PlaySfx(SoundName.BtnPress); } private void SwitchNightNotify(bool bvalue) { btnSwitchOns[6].interactable = !bvalue; btnSwitchOffs[6].interactable = bvalue; NotifyMgr.SetnightNotifiON(bvalue); ES3.Save(Global.ES3_NightNotify, bvalue); SoundMgr.PlaySfx(SoundName.BtnPress); } public void SwitchNightNotifyOn() { SwitchNightNotify(true); } public void SwitchNightNotifyOff() { SwitchNightNotify(false); } public static void StartSwitchNightNotify(bool bvalue) { NotifyMgr.SetnightNotifiON(bvalue); ES3.Save(Global.ES3_NightNotify, bvalue); SoundMgr.PlaySfx(SoundName.BtnPress); } #endregion View #region Name // 닉네임 변경 팝업 열기. public void OpenName() { SoundMgr.PlaySfx(SoundName.BtnPress); inputName.text = DataHandler.PlayData.playerName; goPopupName.SetActive(true); //inputName.isSelected = true; //inputName.selectionStart = 0; //inputName.selectionEnd = DataHandler.PlayData.playerName.Length; } // 닉네임 변경 팝업 닫기. public void CloseName() { SoundMgr.PlaySfx(SoundName.BtnPress); goPopupName.SetActive(false); } // 닉네임 변경. public void BtnNameChange() { if (iLoading > 0) return; // 공백 제거. inputName.text = inputName.text.Trim().Replace(" ", "").Replace(" ", ""); // 특수문자 사용되지 않도록. inputName.text = BanWordFilter.FilterSpChar(inputName.text); // 빈 이름. if (string.IsNullOrEmpty(inputName.text)) { GameUIMgr.SOpenPopup1Button(LocalizationText.GetText("setname_con1")); return; } // 언어 검사. if (!SIsAvailName(inputName.text)) { GameUIMgr.SOpenPopup1Button(LocalizationText.GetText("setname_wrong")); return; } // 금칙어 포함. if (BanWordFilter.ContainBanWord(inputName.text)) { GameUIMgr.SOpenPopup1Button(LocalizationText.GetText("setname_wrong")); return; } // 길이 검사. int ilen = inputName.text.Length; if (ilen < DataHandler.Const.nameMin) { GameUIMgr.SOpenPopup1Button(LocalizationText.GetText("setname_short")); return; } if (ilen > DataHandler.Const.nameMax) { GameUIMgr.SOpenPopup1Button(LocalizationText.GetText("setname_long")); return; } // 현재 이름과 동일함. string strcurname = DataHandler.PlayData.playerName; if (strcurname.Equals(inputName.text)) { GameUIMgr.SOpenPopup1Button(LocalizationText.GetText("error_applied")); return; } // 보석 부족. if (DataHandler.Goods.Dia < DataHandler.Const.nameChangePrice/* && DataHandler.GetTotalRecord().renameCnt >= DataHandler.Const.nameChangeFree*/) { GameUIMgr.SOpenPopup1Button(LocalizationText.GetText(Global.STR_NoGoods)); return; } // 네트워크 상태. if (Application.internetReachability == NetworkReachability.NotReachable) { GameUIMgr.SOpenPopup1Button(LocalizationText.GetText(Global.STR_CheckNetwork)); return; } SoundMgr.PlaySfx(SoundName.BtnPress); iLoading++; CoverCamera.Hold(); nIdStr data = new nIdStr(inputName.text); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.NameChange), typeof(nNameChangeReturn), ANameChangeSucc, ANameChangeFail, data, true); } // 사용 가능한 이름인지. public static bool SIsAvailName(string strname) { foreach (char c in strname) { // 영문 대문자. if (c >= 'A' && c <= 'Z') continue; // 영문 소문자. if (c >= 'a' && c <= 'z') continue; // 숫자. if (c >= '0' && c <= '9') continue; // 러시아. if (c >= 0x0410 && c <= 0x044F) continue; // 독일, 스페인. if (c >= 0x00C4 && c <= 0x00F1) continue; // 한글. if (c >= 0xAC00 && c <= 0xD7A3) continue; // 일본어. if (c >= 0x3040 && c <= 0x30FF) continue; // 일본어2. if (c >= 0x31F0 && c <= 0x31FF) continue; // 한중일 통합 한자 확장A. if (c >= 0x3400 && c <= 0x4DBF) continue; // 한중일 통합 한자. if (c >= 0x4E00 && c <= 0x9FBF) continue; // 한중일 호환용 한자. if (c >= 0xF900 && c <= 0xFAFF) continue; // 한중일 통합 한자 확장 B. if (c >= 0x20000 && c <= 0x2A6DF) continue; // 한중일 통합 한자 확장 C. if (c >= 0x2A700 && c <= 0x2B73F) continue; // 한중일 통합 한자 확장 D. if (c >= 0x2B740 && c <= 0x2B81F) continue; // 한중일 호환용 한자 보충. if (c >= 0x2F800 && c <= 0x2FA1F) continue; //// 그리스. //if (c >= 0x0391 && c <= 0x03C9) // continue; return false; } return true; } // 이름 변경 실패시 처리. private void ANameChangeFail(SvError error, object request) { CoverCamera.Release(); iLoading--; } // 이름 변경 성공시 처리. private void ANameChangeSucc(object result, object request) { nNameChangeReturn data = result as nNameChangeReturn; if (data == null || data.playCurrency == null) { ANameChangeFail(new SvError(eErrorCode.NULL_OR_EMPTY), request); return; } DataHandler.SetGoods(data.playCurrency, false); DataHandler.PlayData.playerName = data.playUser.playerName; txtName.text = DataHandler.PlayData.playerName; GameUIMgr.SOpenToast(LocalizationText.GetText("msg_changenick")); CloseName(); btnName.interactable = DataHandler.Const.nameChangePrice <= (DataHandler.Goods.diaFree + DataHandler.Goods.diaPaid); GameUIMgr.SSetPlayerName(); ChatMgr.SUpdateNickname(); CoverCamera.Release(); iLoading--; } #endregion Name #region Coupon // 쿠폰 사용. public void BtnCouponUse() { if (iLoading > 0) return; // 공백 제거. inputCoupon.text = inputCoupon.text.Trim().Replace(" ", "").Replace(" ", ""); // 특수문자 사용되지 않도록. inputCoupon.text = BanWordFilter.FilterSpChar(inputCoupon.text); // 빈 문자. if (string.IsNullOrEmpty(inputCoupon.text)) { GameUIMgr.SOpenPopup1Button(LocalizationText.GetText("setting_coupondesc")); return; } if (Application.internetReachability == NetworkReachability.NotReachable) { GameUIMgr.SOpenPopup1Button(LocalizationText.GetText(Global.STR_CheckNetwork)); return; } SoundMgr.PlaySfx(SoundName.BtnPress); iLoading++; CoverCamera.Hold(); nCoupon data = new nCoupon(inputCoupon.text); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.Coupon), typeof(nGoodsGet), ACouponSucc, ACouponFail, data, true); } // 쿠폰 통신 실패시 처리. private void ACouponFail(SvError error, object request) { CoverCamera.Release(); iLoading--; } // 쿠폰 통신 성공시 처리. private void ACouponSucc(object result, object request) { nGoodsGet data = result as nGoodsGet; if (data == null || data.playCurrency == null || data.result == null) { ACouponFail(new SvError(eErrorCode.NULL_OR_EMPTY), request); return; } DataHandler.AddGoods(data.result, data.playCurrency, true); GameUIMgr.SOpenPopupGoods(data.result); CoverCamera.Release(); iLoading--; } #endregion Coupon #region Menu // 서버 저장. public void BtnSave() { if (iLoading > 0) return; iLoading++; CoverCamera.Hold(); SingleMgr.SaveDataSetting(); SoundMgr.PlaySfx(SoundName.BtnPress); } // 서버 저장 실패. public static void SSaveFail() { CoverCamera.Release(); curMgr.iLoading--; } // 서버 저장 성공. public static void SSaveSucc() { GameUIMgr.SOpenPopup1Button(LocalizationText.GetText(Global.STR_Saved)); CoverCamera.Release(); curMgr.iLoading--; } // 리뷰 작성. public void BtnReview() { if (iLoading > 0) return; CoverCamera.Hold(); Invoke("RemoveCover", 2f); SoundMgr.PlaySfx(SoundName.BtnPress); Application.OpenURL(LocalizationText.GetText(Global.MURL_Review)); } // 커뮤니티. public void BtnCommunity() { if (iLoading > 0) return; CoverCamera.Hold(); Invoke("RemoveCover", 2f); SoundMgr.PlaySfx(SoundName.BtnPress); Application.OpenURL(LocalizationText.GetText(Global.MURL_Community)); } public void OpenTerm() { if (iLoading > 0) return; CoverCamera.Hold(); SoundMgr.PlaySfx(SoundName.BtnPress); Invoke("RemoveCover", 2f); Application.OpenURL(LocalizationText.GetText(Global.MURL_ShopTerms)); } private void RemoveCover() { CoverCamera.Release(); } #endregion Menu #region Language // 언어 팝업 열기. public void OpenLang() { SoundMgr.PlaySfx(SoundName.BtnPress); goPopupLang.SetActive(true); SetCurLang(); } // 언어 팝업 닫기. public void CloseLang() { SoundMgr.PlaySfx(SoundName.BtnPress); goPopupLang.SetActive(false); } // 현재 언어 세팅. private void SetCurLang() { selectedLang = SingleMgr.GetSavedLanguage(); switch (selectedLang) { case SystemLanguage.Korean: tglLangs[1].SetIsOnWithoutNotify(true); break; case SystemLanguage.Japanese: tglLangs[2].SetIsOnWithoutNotify(true); break; default: tglLangs[0].SetIsOnWithoutNotify(true); break; } } public void BtnLangEn() { SoundMgr.PlaySfx(SoundName.BtnPress); OnBtnLang(SystemLanguage.English); } public void BtnLangKo() { SoundMgr.PlaySfx(SoundName.BtnPress); OnBtnLang(SystemLanguage.Korean); } public void BtnLangJa() { SoundMgr.PlaySfx(SoundName.BtnPress); OnBtnLang(SystemLanguage.Japanese); } // 언어 선택. private void OnBtnLang(SystemLanguage lang) { if (lang == selectedLang) return; selectedLang = lang; } // 선택한 언어 적용. public void BtnLangApply() { if (selectedLang == SingleMgr.GetSavedLanguage()) { return; } CoverCamera.Hold(); ES3.Save(Global.ES3_Language, (int)selectedLang); SoundMgr.PlaySfx(SoundName.BtnPress); #if !USE_LOCAL_LOCALIZATION SvConnectManager.Instance.RequestSvString(true, 2, UrlApi.GetAssetUrl(UrlApi.AsLocalize), ALocalizeSucc, ALocalizeFail); #else LocalizationText.SetLanguage(selectedLang); LocalizationText.CreateContent(); ApplyLang(); #endif } #if !USE_LOCAL_LOCALIZATION // 통신 실패 - 로컬라이즈. private void ALocalizeFail(SvError error) { Debug.LogError("LocalizationText load fail."); ApplyLang(); } // 통신 성공 - 로컬라이즈. private void ALocalizeSucc(string strresult) { if (string.IsNullOrEmpty(strresult)) { ALocalizeFail(new SvError(eErrorCode.NULL_OR_EMPTY)); return; } LocalizationText.SetLanguage(selectedLang); LocalizationText.CreateContent(strresult); ApplyLang(); OnLanguageChange?.Invoke(); } #endif // 인게임 언어 적용. private void ApplyLang() { Localize(true); Localize(false); BattleMgr.SLocalize(); GameUIMgr.SReLocalize(); GameUIMgr.SSetPlayerTitle(DataHandler.PlayData.playerTitle); AttendMgr.SReLocalize(); BagMgr.SReLocalize(); TreasureMgr.SReLocalize(); CustomizeMgr.SReLocalize(); DungeonMgr.SReLocalize(); EnhanceMgr.SReLocalize(); EventMgr.SReLocalize(); GachaMgr.SReLocalize(); PetMgr.SReLocalize(); SkillMgr.SReLocalize(); StageMgr.SReLocalize(); AdBuffMgr.SReLocalize(); ChatMgr.SReLocalize(); NoticeMgr.SReLocalize(); MailMgr.SReLocalize(); ShopMgr.SReLocalize(); PassMgr.SReLocalize(); ProfileMgr.SReLocalize(); GoodsInfo.SReLocalize(); QuestMgr.SReLocalize(); PvpMgr.SReLocalize(); SleepModeMgr.SReLocalize(); MissionMgr.SReLocalize(); CoverCamera.Release(); goPopupLang.SetActive(false); } #endregion Language #region CS public void OpenCs() { SoundMgr.PlaySfx(SoundName.BtnPress); goPopupCs.SetActive(true); } public void CloseCs() { SoundMgr.PlaySfx(SoundName.BtnPress); goPopupCs.SetActive(false); } // 게임 플레이. public void BtnCsPlay() { SoundMgr.PlaySfx(SoundName.BtnPress); } // 결제. public void BtnCsPurchase() { SoundMgr.PlaySfx(SoundName.BtnPress); } // 의견. public void BtnCsSugg() { SoundMgr.PlaySfx(SoundName.BtnPress); } // 기타. public void BtnCsEtc() { SoundMgr.PlaySfx(SoundName.BtnPress); } #endregion CS #region Account // 로그아웃. public void BtnLogout() { FirebaseLoginMgr.SOnSightOut(); SoundMgr.PlaySfx(SoundName.BtnPress); } // 현재 서버 데이터 삭제. public void BtnDeleteServer() { GameUIMgr.SOpenPopup2Button(LocalizationText.GetText("delete_acc_server"), SVDeleteServerTry); SoundMgr.PlaySfx(SoundName.BtnPress); } // 계정 삭제. public void BtnDeleteAccount() { GameUIMgr.SOpenPopup2Button(LocalizationText.GetText("delete_acc_all"), SVDeleteAccountTry); SoundMgr.PlaySfx(SoundName.BtnPress); } // 서버 계정 삭제 통신 void SVDeleteServerTry() { SvConnectManager.Instance.RequestSvPost(true, 1, UrlApi.GetUrl(UrlApi.DeleteServer), typeof(nIdLvInfo), curMgr.ADeleteServerSucc, curMgr.ADeleteServerFail, new nToken(SingleMgr.UserToken, MainMgr.ServerChannelNumber), false, true, 0); } // 통신 실패 - 서버 계정 삭제. private void ADeleteServerFail(SvError error, object request) { iLoading--; } // 통신 성공 - 서버 계정 삭제. private void ADeleteServerSucc(object result, object request) { GameUIMgr.SOpenPopup1Button(LocalizationText.GetText("delete_acc_server_confirm"), SingleMgr.GameFinishDate); CoverCamera.Release(); SvConnectManager.Instance.StopConnection(); iLoading--; } // 모든 계정 삭제 통신 void SVDeleteAccountTry() { SvConnectManager.Instance.RequestSvPost(true, 1, UrlApi.GetUrl(UrlApi.DeleteAccount), typeof(nIdLvInfo), curMgr.ADeleteAccountSucc, curMgr.ADeleteAccountFail, new nToken(SingleMgr.UserToken), false, true, 0); } // 통신 실패 - 모든 계정 삭제. private void ADeleteAccountFail(SvError error, object request) { iLoading--; } // 통신 성공 - 모든 계정 삭제. private void ADeleteAccountSucc(object result, object request) { GameUIMgr.SOpenPopup1Button(LocalizationText.GetText("delete_acc_all_confirm"), SingleMgr.GameFinishDate); CoverCamera.Release(); SvConnectManager.Instance.StopConnection(); iLoading--; } #endregion Account #region Test public void OpenTest() { groupTest.SetActive(true); } public void TestGold() { #if !VER_DEV && !VER_TEST && !VER_ZOMBIE return; #endif DataHandler.AddGold(System.Numerics.BigInteger.Parse("100000000000000000000")); nGoods[] goods = new nGoods[1] { new nGoods(cGoods.TCurrency, cGoods.CGold, System.Numerics.BigInteger.Parse("100000000000000000000")) }; GameUIMgr.SOpenPopupGoods(goods); } public void TestDia() { #if !VER_DEV && !VER_TEST && !VER_ZOMBIE return; #endif CoverCamera.Hold(); nGoods data = new nGoods(cGoods.TCurrency, cGoods.CDiaF, 100000000L); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.Property), typeof(nGoodsGet), AGetPropertySucc, AGetPropertyFail, data, true); } public void TestEnhanceStone() { #if !VER_DEV && !VER_TEST && !VER_ZOMBIE return; #endif CoverCamera.Hold(); nGoods data = new nGoods(cGoods.TCurrency, cGoods.CEnhanceStoneGear, 10000000L); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.Property), typeof(nGoodsGet), AGetPropertySucc, AGetPropertyFail, data, true); } public void TestAwakenStone() { #if !VER_DEV && !VER_TEST && !VER_ZOMBIE return; #endif CoverCamera.Hold(); nGoods data = new nGoods(cGoods.TCurrency, cGoods.CAwakenStoneGear, 1000000L); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.Property), typeof(nGoodsGet), AGetPropertySucc, AGetPropertyFail, data, true); } public void TestChangeStone() { #if !VER_DEV && !VER_TEST && !VER_ZOMBIE return; #endif CoverCamera.Hold(); nGoods data = new nGoods(cGoods.TCurrency, cGoods.CChangeStone, 1000000L); EnhanceMgr.TestSettingAwakenBtnTrue(); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.Property), typeof(nGoodsGet), AGetPropertySucc, AGetPropertyFail, data, true); } public void TestLvPoint() { #if !VER_DEV && !VER_TEST && !VER_ZOMBIE return; #endif CoverCamera.Hold(); nGoods data = new nGoods(cGoods.TCurrency, cGoods.CLvPoint, 1000L); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.Property), typeof(nGoodsGet), AGetPropertySucc, AGetPropertyFail, data, true); } public void TestPudding() { #if !VER_DEV && !VER_TEST && !VER_ZOMBIE return; #endif CoverCamera.Hold(); nGoods data = new nGoods(cGoods.TCurrency, cGoods.CPudding, 100000L); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.Property), typeof(nGoodsGet), AGetPropertySucc, AGetPropertyFail, data, true); } public void TestGachaWeapon() { #if !VER_DEV && !VER_TEST && !VER_ZOMBIE return; #endif CoverCamera.Hold(); nGoods data = new nGoods(cGoods.TCurrency, cGoods.CGachaTokenWeapon, 500L); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.Property), typeof(nGoodsGet), AGetPropertySucc, AGetPropertyFail, data, true); } public void TestGachaArmor() { #if !VER_DEV && !VER_TEST && !VER_ZOMBIE return; #endif CoverCamera.Hold(); nGoods data = new nGoods(cGoods.TCurrency, cGoods.CGachaTokenArmor, 500L); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.Property), typeof(nGoodsGet), AGetPropertySucc, AGetPropertyFail, data, true); } public void TestGachaAcc() { #if !VER_DEV && !VER_TEST && !VER_ZOMBIE return; #endif CoverCamera.Hold(); nGoods data = new nGoods(cGoods.TCurrency, cGoods.CGachaTokenAcce, 500L); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.Property), typeof(nGoodsGet), AGetPropertySucc, AGetPropertyFail, data, true); } public void TestGachaTreasure() { #if !VER_DEV && !VER_TEST && !VER_ZOMBIE return; #endif CoverCamera.Hold(); nGoods data = new nGoods(cGoods.TCurrency, cGoods.CGachaTokenTreasure, 500L); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.Property), typeof(nGoodsGet), AGetPropertySucc, AGetPropertyFail, data, true); } public void TestGearBox() { #if !VER_DEV && !VER_TEST && !VER_ZOMBIE return; #endif CoverCamera.Hold(); nGoods data = new nGoods(cGoods.TBox, UnityEngine.Random.Range(cGoods.CBoxGeneralStart, cGoods.CBoxGeneralStart + 28), 10L); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.Property), typeof(nGoodsGet), AGetPropertySucc, AGetPropertyFail, data, true); } public void TestPetBox() { #if !VER_DEV && !VER_TEST && !VER_ZOMBIE return; #endif CoverCamera.Hold(); nGoods data = new nGoods(cGoods.TBox, UnityEngine.Random.Range(cGoods.CBoxPetStart, cGoods.CBoxPetStart + 28), 10L); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.Property), typeof(nGoodsGet), AGetPropertySucc, AGetPropertyFail, data, true); } public void TestDiaryBox() { #if !VER_DEV && !VER_TEST && !VER_ZOMBIE return; #endif CoverCamera.Hold(); nGoods data = new nGoods(cGoods.TBox, cGoods.CBoxDiary, 50L); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.Property), typeof(nGoodsGet), AGetPropertySucc, AGetPropertyFail, data, true); } public void TestIris() { #if !VER_DEV && !VER_TEST && !VER_ZOMBIE return; #endif } public void TestColorBox() { #if !VER_DEV && !VER_TEST && !VER_ZOMBIE return; #endif } public void TestCosCloth() { #if !VER_DEV && !VER_TEST && !VER_ZOMBIE return; #endif CoverCamera.Hold(); int icode = 2; if (DataHandler.GetCosCloth(icode).have) { icode = 3; if (DataHandler.GetCosCloth(icode).have) { icode = 4; if (DataHandler.GetCosCloth(icode).have) { icode = 5; if (DataHandler.GetCosCloth(icode).have) { icode = 6; if (DataHandler.GetCosCloth(icode).have) { icode = 7; if (DataHandler.GetCosCloth(icode).have) { icode = 8; if (DataHandler.GetCosCloth(icode).have) { icode = 9; if (DataHandler.GetCosCloth(icode).have) { icode = 10; if (DataHandler.GetCosCloth(icode).have) { icode = 11; if (DataHandler.GetCosCloth(icode).have) { icode = 12; if (DataHandler.GetCosCloth(icode).have) { icode = 13; if (DataHandler.GetCosCloth(icode).have) { icode = 14; if (DataHandler.GetCosCloth(icode).have) { icode = 15; if (DataHandler.GetCosCloth(icode).have) { icode = 16; if (DataHandler.GetCosCloth(icode).have) { icode = 17; if (DataHandler.GetCosCloth(icode).have) { icode = 18; if (DataHandler.GetCosCloth(icode).have) { icode = 19; if (DataHandler.GetCosCloth(icode).have) { icode = 20; if (DataHandler.GetCosCloth(icode).have) { GameUIMgr.SOpenPopup1Button("Already Have"); CoverCamera.Release(); return; } } } } } } } } } } } } } } } } } } } nGoods data = new nGoods(cGoods.TCosCloth, icode, 1L); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.Property), typeof(nGoodsGet), AGetPropertySucc, AGetPropertyFail, data, true); } public void TestCosWeapon() { #if !VER_DEV && !VER_TEST && !VER_ZOMBIE return; #endif CoverCamera.Hold(); int icode = 2; if (DataHandler.GetCosWeapon(icode).have) { icode = 3; if (DataHandler.GetCosWeapon(icode).have) { icode = 4; if (DataHandler.GetCosWeapon(icode).have) { icode = 5; if (DataHandler.GetCosWeapon(icode).have) { icode = 6; if (DataHandler.GetCosWeapon(icode).have) { icode = 7; if (DataHandler.GetCosWeapon(icode).have) { icode = 8; if (DataHandler.GetCosWeapon(icode).have) { icode = 9; if (DataHandler.GetCosWeapon(icode).have) { icode = 10; if (DataHandler.GetCosWeapon(icode).have) { icode = 11; if (DataHandler.GetCosWeapon(icode).have) { icode = 12; if (DataHandler.GetCosWeapon(icode).have) { icode = 13; if (DataHandler.GetCosWeapon(icode).have) { icode = 14; if (DataHandler.GetCosWeapon(icode).have) { icode = 15; if (DataHandler.GetCosWeapon(icode).have) { icode = 16; if (DataHandler.GetCosWeapon(icode).have) { icode = 17; if (DataHandler.GetCosWeapon(icode).have) { icode = 18; if (DataHandler.GetCosWeapon(icode).have) { icode = 19; if (DataHandler.GetCosWeapon(icode).have) { icode = 20; if (DataHandler.GetCosWeapon(icode).have) { GameUIMgr.SOpenPopup1Button("Already Have"); CoverCamera.Release(); return; } } } } } } } } } } } } } } } } } } } nGoods data = new nGoods(cGoods.TCosWeapon, icode, 1L); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.Property), typeof(nGoodsGet), AGetPropertySucc, AGetPropertyFail, data, true); } public void TestPet() { #if !VER_DEV && !VER_TEST && !VER_ZOMBIE return; #endif CoverCamera.Hold(); int icode = -1; System.Collections.Generic.Dictionary pets = DataHandler.GetPets(); foreach (var item in pets) { if (item.Value.have) continue; icode = item.Key; break; } if (icode < 0) { GameUIMgr.SOpenPopup1Button("Already Have"); CoverCamera.Release(); return; } nGoods data = new nGoods(cGoods.TPet, icode, 1L); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.Property), typeof(nGoodsGet), AGetPropertySucc, AGetPropertyFail, data, true); } public void TestPetSpirit() { #if !VER_DEV && !VER_TEST && !VER_ZOMBIE return; #endif CoverCamera.Hold(); System.Collections.Generic.Dictionary pets = DataHandler.GetPets(); int icode = UnityEngine.Random.Range(1, pets.Count + 1); nGoods data = new nGoods(cGoods.TPetSpirit, icode, 100L); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.Property), typeof(nGoodsGet), AGetPropertySucc, AGetPropertyFail, data, true); } public void TestTicketGold() { #if !VER_DEV && !VER_TEST && !VER_ZOMBIE return; #endif CoverCamera.Hold(); nGoods data = new nGoods(cGoods.TDgTicketGold, cGoods.TDgTicketGold, 10); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.Property), typeof(nGoodsGet), AGetPropertySucc, AGetPropertyFail, data, true); } public void TestTicketPet() { #if !VER_DEV && !VER_TEST && !VER_ZOMBIE return; #endif CoverCamera.Hold(); nGoods data = new nGoods(cGoods.TDgTicketPet, cGoods.TDgTicketPet, 10); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.Property), typeof(nGoodsGet), AGetPropertySucc, AGetPropertyFail, data, true); } public void TestTicketEnhance() { #if !VER_DEV && !VER_TEST && !VER_ZOMBIE return; #endif CoverCamera.Hold(); nGoods data = new nGoods(cGoods.TDgTicketEnhance, cGoods.TDgTicketEnhance, 10); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.Property), typeof(nGoodsGet), AGetPropertySucc, AGetPropertyFail, data, true); } public void TestTicketAwaken() { #if !VER_DEV && !VER_TEST && !VER_ZOMBIE return; #endif CoverCamera.Hold(); nGoods data = new nGoods(cGoods.TDgTicketAwaken, cGoods.TDgTicketAwaken, 10); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.Property), typeof(nGoodsGet), AGetPropertySucc, AGetPropertyFail, data, true); } public void TestTicketPvp() { #if !VER_DEV && !VER_TEST && !VER_ZOMBIE return; #endif CoverCamera.Hold(); nGoods data = new nGoods(cGoods.TPvpTicket, cGoods.TPvpTicket, 10); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.Property), typeof(nGoodsGet), AGetPropertySucc, AGetPropertyFail, data, true); } public void TestTicketRelic() { #if !VER_DEV && !VER_TEST && !VER_ZOMBIE return; #endif CoverCamera.Hold(); nGoods data = new nGoods(cGoods.TDgTicketRelic, cGoods.TDgTicketRelic, 10); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.Property), typeof(nGoodsGet), AGetPropertySucc, AGetPropertyFail, data, true); } public void TestLench() { #if !VER_DEV && !VER_TEST && !VER_ZOMBIE return; #endif CoverCamera.Hold(); nGoods data = new nGoods(cGoods.TCurrency, cGoods.CCondMight, 100000); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.Property), typeof(nGoodsGet), AGetPropertySucc, AGetPropertyFail, data, true); } // 테스트 재화 획득 통신 실패. private void AGetPropertyFail(SvError error, object request) { GameUIMgr.SOpenPopup1Button("Test Property Fail."); CoverCamera.Release(); } // 테스트 재화 획득 통신 성공. private void AGetPropertySucc(object result, object request) { nGoodsGet data = result as nGoodsGet; if (data == null) { AGetPropertyFail(new SvError(eErrorCode.NULL_OR_EMPTY), request); return; } nGoods[] goods = new nGoods[1] { request as nGoods }; DataHandler.AddGoods(goods, data.playCurrency, true); GameUIMgr.SOpenPopupGoods(goods); CoverCamera.Release(); } /// *************** 임시 테스트 기능 : 펫 3종 획득 public static void SGetPetT() { curMgr.GetPetT(); } public void GetPetT() { #if !VER_DEV && !VER_TEST && !VER_ZOMBIE return; #endif System.Collections.Generic.Dictionary pets = DataHandler.GetPets(); for(int i = 0; i < 3; i++) { if (pets[i + 1].have) return; } nGoods data = new nGoods(cGoods.TPet, 1, 1L); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.Property), typeof(nGoodsGet), AGetPetSuccT, AGetPetFailT, data, true); DataHandler.AddPet(1); nGoods data2 = new nGoods(cGoods.TPet, 2, 1L); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.Property), typeof(nGoodsGet), AGetPetSuccT, AGetPetFailT, data2, true); DataHandler.AddPet(2); nGoods data3 = new nGoods(cGoods.TPet, 3, 1L); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.Property), typeof(nGoodsGet), AGetPetSuccT, AGetPetFailT, data3, true); DataHandler.AddPet(3); } private void AGetPetFailT(SvError error, object request) { CoverCamera.Release(); } private void AGetPetSuccT(object result, object request) { nGoodsGet data = result as nGoodsGet; if (data == null) { AGetPropertyFail(new SvError(eErrorCode.NULL_OR_EMPTY), request); return; } } /// *************** public static void STestRefreshDate() { curMgr.TestRefreshDate(); } public void TestRefreshDate() { #if !VER_DEV && !VER_TEST && !VER_ZOMBIE return; #endif nIdCnt data = new nIdCnt(); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.Refresh), typeof(nIdCnt), ARefreshTodaySucc, ARefreshTodayFail, data, true); } private void ARefreshTodaySucc(object result, object request) { SingleMgr.GameFinishSvSave(); } private void ARefreshTodayFail(SvError error, object request) { GameUIMgr.SOpenPopup1Button("Test Property Fail."); CoverCamera.Release(); } public void btnResetGold() { if(DataHandler.Goods.gold > 0) { DataHandler.SubGold(DataHandler.Goods.gold); GameUIMgr.SOpenToast("Reset Complete"); } } public void btnResetGoods(int inum) { nIdCnt data = new nIdCnt(inum); CoverCamera.Hold(); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.ResetGoods), typeof(nGoodsGet), AResetGoodsSucc, AResetGoodsFail, data, true); } public void btnResetGoodsAll() { nIdCnt data = new nIdCnt(); CoverCamera.Hold(); SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.ResetGoodsAll), typeof(nGoodsGet), AResetGoodsSucc, AResetGoodsFail, data, true); } private void AResetGoodsSucc(object result, object request) { nGoodsGet data = result as nGoodsGet; if (data == null) { AGetPropertyFail(new SvError(eErrorCode.NULL_OR_EMPTY), request); return; } DataHandler.SetGoods(data.playCurrency,false); GameUIMgr.SOpenToast("Reset Complete"); CoverCamera.Release(); } private void AResetGoodsFail(SvError error, object request) { GameUIMgr.SOpenPopup1Button("Test Property Fail."); CoverCamera.Release(); } private bool TestMod = false; public void SetTestMod() { if (!TestMod) { TestMod = true; btnTestMod.transform.GetChild(0).gameObject.SetActive(!TestMod); GameUIMgr.SOpenToast("Test Mode On"); btnTest.gameObject.SetActive(true); ES3.Save(Global.ES3_TestMod, TestMod); } else { TestMod = false; btnTestMod.transform.GetChild(0).gameObject.SetActive(!TestMod); GameUIMgr.SOpenToast("Test Mode Off"); btnTest.gameObject.SetActive(false); ES3.Save(Global.ES3_TestMod, TestMod); } } public static bool SGetTest() { return curMgr.TestMod; } #endregion Test #region Test Reset Mission public void ResetMission() { if (iLoading > 0) return; iLoading++; CoverCamera.Hold(); BattleMgr.Instance.BattlePause = true; SvConnectManager.Instance.RequestSvPost(true, 0, UrlApi.GetUrl(UrlApi.ResetMission), typeof(nIdCnt), AResetMissionSucc, AResetMissionFail, new nIdCnt(), true); iLoading--; } private void AResetMissionFail(SvError error, object request) { GameUIMgr.SOpenPopup1Button("Reset Mission Fail."); CoverCamera.Release(); } private void AResetMissionSucc(object result, object request) { GameUIMgr.SOpenPopup1Button(LocalizationText.GetText("Mission_Reset"), SingleMgr.GameFinishDate); CoverCamera.Release(); SvConnectManager.Instance.StopConnection(); } #endregion Test Reset Mission }