diff --git a/Assets/RedHotRoast/Define/Message/GameMsg_Logic.cs b/Assets/RedHotRoast/Define/Message/GameMsg_Logic.cs index eab9bf46..e7f21c4a 100644 --- a/Assets/RedHotRoast/Define/Message/GameMsg_Logic.cs +++ b/Assets/RedHotRoast/Define/Message/GameMsg_Logic.cs @@ -66,6 +66,9 @@ namespace RedHotRoast public static uint liveVideoLoaded = ++Cursor_BASE; public static uint sendLog = ++Cursor_BASE; + public static uint ThemeChange = ++Cursor_BASE; + public static uint UpdateSpeed = ++Cursor_BASE; + public static uint UseProps = ++Cursor_BASE; public static uint StopArrowTouch = ++Cursor_BASE; public static uint refreshGift = ++Cursor_BASE; diff --git a/Assets/RedHotRoast/Define/Message/UICtrlMsg_OpenClose.cs b/Assets/RedHotRoast/Define/Message/UICtrlMsg_OpenClose.cs index aa9f972c..241c76d0 100644 --- a/Assets/RedHotRoast/Define/Message/UICtrlMsg_OpenClose.cs +++ b/Assets/RedHotRoast/Define/Message/UICtrlMsg_OpenClose.cs @@ -168,9 +168,14 @@ namespace RedHotRoast public static uint RedeemCodeUI_Open = ++cursor_OpenClose; public static uint RedeemCodeUI_Close = ++cursor_OpenClose; + public static uint ArrowTipsUI_Open = ++cursor_OpenClose; + public static uint ArrowTipsUI_Close = ++cursor_OpenClose; + public static uint MakeupConfirmUI_Close = ++cursor_OpenClose; public static uint MakeupConfirmUI_Open = ++cursor_OpenClose; public static uint SaveingPotUI_Open = ++cursor_OpenClose; public static uint SaveingPotUI_Close = ++cursor_OpenClose; + public static uint ArrowSettingUI_Open = ++cursor_OpenClose; + public static uint ArrowSettingUI_Close = ++cursor_OpenClose; } } \ No newline at end of file diff --git a/Assets/RedHotRoast/Define/Model/Config/Game/ArrowGameConfigModel.cs b/Assets/RedHotRoast/Define/Model/Config/Game/ArrowGameConfigModel.cs new file mode 100644 index 00000000..e504aef6 --- /dev/null +++ b/Assets/RedHotRoast/Define/Model/Config/Game/ArrowGameConfigModel.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; +using SGModule.ConfigLoader; + +namespace IgnoreOPS +{ + [ConfigKey("ArrowGameConfig")] + public class ArrowGameConfig + { + public int id; + public string levelName; + public int gridRows; + public int gridCols; + public int pointSpacing; + public string arrows; + } + +} \ No newline at end of file diff --git a/Assets/RedHotRoast/Define/Model/Config/Game/ArrowGameConfigModel.cs.meta b/Assets/RedHotRoast/Define/Model/Config/Game/ArrowGameConfigModel.cs.meta new file mode 100644 index 00000000..3da00cda --- /dev/null +++ b/Assets/RedHotRoast/Define/Model/Config/Game/ArrowGameConfigModel.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0d0a4dc1573b454ba9ec50df8d7dea64 +timeCreated: 1783664763 \ No newline at end of file diff --git a/Assets/RedHotRoast/Define/Model/Config/Game/CommonModel.cs b/Assets/RedHotRoast/Define/Model/Config/Game/CommonModel.cs index ea08a061..f57adf05 100644 --- a/Assets/RedHotRoast/Define/Model/Config/Game/CommonModel.cs +++ b/Assets/RedHotRoast/Define/Model/Config/Game/CommonModel.cs @@ -84,12 +84,20 @@ namespace RedHotRoast public int darkThoughProbability; public int Dailyrefreshtimes; + public int Smallrewardsrate; public int PiggyBankSwitch; public int ExpiryUnlock; public int BalanceExpired; - public int ExchangeModeToggle; public int ExchangeProcessMode; public int CHProcessMode; + public int PiggyPropCD; + public int SmallReward; + public int ProcessingTime; + public int WwalaccelerationCD; + public int[] inlineInitNum; + public int[] BalanceExchange; + public int[] PotExchange; + } } diff --git a/Assets/RedHotRoast/Define/Model/Config/Game/MakeupModel.cs b/Assets/RedHotRoast/Define/Model/Config/Game/MakeupModel.cs index 13488ea8..c6873930 100644 --- a/Assets/RedHotRoast/Define/Model/Config/Game/MakeupModel.cs +++ b/Assets/RedHotRoast/Define/Model/Config/Game/MakeupModel.cs @@ -1,53 +1,57 @@ -using System.Linq; -using SGModule.ConfigLoader; - -namespace RedHotRoast { - public class MakeupModel { - public static Makeup GetData(int id) { - return ConfigSystem.GetConfig().FirstOrDefault(makeup => makeup.id == id); - } - } - - [ConfigKey("makeup")] - public class Makeup { - public int id; - public int item_need; - public bool is_onetime; - public int task_need; - public int ad_need; - public int item; - public int levels_need; - public int AD_Down; - public int AD_Limit_times; - public int Login_Limit_times; - public int Active_time; - public int Active_time_Down; - public int Active_Limit_times; - } - - public class MakeupModel_2 { - public static Makeup_2 GetData(int id) { - return ConfigSystem.GetConfig().FirstOrDefault(makeup => makeup.id == id); - } - } - - [ConfigKey("makeup_2")] - public class Makeup_2 { - public int id; - public int item_need; - public bool is_onetime; - public int task_need; - public int ad_need; - public int item; - public int levels_need; - public int AD_Down; - public int AD_Limit_times; - public int Login_Limit_times; - public int Active_time; - public int Active_time_Down; - public int Active_Limit_times; - public int Reset_time; - public float ADIncrease; - public int PayIncrease; - } -} +using System.Linq; +using SGModule.ConfigLoader; + +namespace RedHotRoast { + public class MakeupModel { + public static Makeup GetData(int id) { + return ConfigSystem.GetConfig().FirstOrDefault(makeup => makeup.id == id); + } + } + + [ConfigKey("makeup")] + public class Makeup { + public int id; + public int item_need; + public bool is_onetime; + public int task_need; + public int ad_need; + public int item; + public int levels_need; + public int AD_Down; + public int AD_Limit_times; + public int Login_Limit_times; + public int Active_time; + public int Active_time_Down; + public int Active_Limit_times; + public string[] T_Redeemcode; + public string T_ShopURL; + } + + public class MakeupModel_2 { + public static Makeup_2 GetData(int id) { + return ConfigSystem.GetConfig().FirstOrDefault(makeup => makeup.id == id); + } + } + + [ConfigKey("makeup_2")] + public class Makeup_2 { + public int id; + public int item_need; + public bool is_onetime; + public int task_need; + public int ad_need; + public int item; + public int levels_need; + public int AD_Down; + public int AD_Limit_times; + public int Login_Limit_times; + public int Active_time; + public int Active_time_Down; + public int Active_Limit_times; + public int Reset_time; + public float ADIncrease; + public int PayIncrease; + public string[] C_Redeemcode; + public string C_ShopURL; + } +} diff --git a/Assets/RedHotRoast/FGUI/package/GameResult_08/com_arrow_end_again.cs b/Assets/RedHotRoast/FGUI/package/GameResult_08/com_arrow_end_again.cs index 10cd6bb9..f54a43ae 100644 --- a/Assets/RedHotRoast/FGUI/package/GameResult_08/com_arrow_end_again.cs +++ b/Assets/RedHotRoast/FGUI/package/GameResult_08/com_arrow_end_again.cs @@ -8,8 +8,8 @@ namespace FGUI.GameResult_08 public partial class com_arrow_end_again : GComponent { public GTextField title; - public GComponent btn_back; - public GComponent btn_revive; + public GButton btn_back; + public GButton btn_revive; public GButton btn_restart; public const string URL = "ui://8sjqw0q3rsd42h"; @@ -23,8 +23,8 @@ namespace FGUI.GameResult_08 base.ConstructFromXML(xml); title = (GTextField)GetChildAt(2); - btn_back = (GComponent)GetChildAt(3); - btn_revive = (GComponent)GetChildAt(5); + btn_back = (GButton)GetChildAt(3); + btn_revive = (GButton)GetChildAt(5); btn_restart = (GButton)GetChildAt(6); } } diff --git a/Assets/RedHotRoast/FGUI/package/ZM_Common_01/ZM_Common_01Binder.cs b/Assets/RedHotRoast/FGUI/package/ZM_Common_01/ZM_Common_01Binder.cs index 5eb8f449..545933d9 100644 --- a/Assets/RedHotRoast/FGUI/package/ZM_Common_01/ZM_Common_01Binder.cs +++ b/Assets/RedHotRoast/FGUI/package/ZM_Common_01/ZM_Common_01Binder.cs @@ -13,6 +13,7 @@ namespace FGUI.ZM_Common_01 UIObjectFactory.SetPackageItemExtension(btn_head.URL, typeof(btn_head)); UIObjectFactory.SetPackageItemExtension(btn_chat.URL, typeof(btn_chat)); UIObjectFactory.SetPackageItemExtension(com_money.URL, typeof(com_money)); + UIObjectFactory.SetPackageItemExtension(com_open_tips.URL, typeof(com_open_tips)); UIObjectFactory.SetPackageItemExtension(com_broadcast1.URL, typeof(com_broadcast1)); UIObjectFactory.SetPackageItemExtension(com_broadcast_text1.URL, typeof(com_broadcast_text1)); UIObjectFactory.SetPackageItemExtension(btn_curr.URL, typeof(btn_curr)); diff --git a/Assets/RedHotRoast/FGUI/package/ZM_Common_01/btn_watchAd.cs b/Assets/RedHotRoast/FGUI/package/ZM_Common_01/btn_watchAd.cs index e3895477..22a6ef0f 100644 --- a/Assets/RedHotRoast/FGUI/package/ZM_Common_01/btn_watchAd.cs +++ b/Assets/RedHotRoast/FGUI/package/ZM_Common_01/btn_watchAd.cs @@ -11,6 +11,7 @@ namespace FGUI.ZM_Common_01 public Controller can_buy; public GTextField btn_text; public GTextField watch; + public GImage img_saveingpot; public const string URL = "ui://o9974uc5b7ax1h"; public static btn_watchAd CreateInstance() @@ -26,6 +27,7 @@ namespace FGUI.ZM_Common_01 can_buy = GetControllerAt(1); btn_text = (GTextField)GetChildAt(2); watch = (GTextField)GetChildAt(3); + img_saveingpot = (GImage)GetChildAt(6); } } } \ No newline at end of file diff --git a/Assets/RedHotRoast/FGUI/package/ZM_Common_01/com_open_tips.cs b/Assets/RedHotRoast/FGUI/package/ZM_Common_01/com_open_tips.cs new file mode 100644 index 00000000..d0e81cd8 --- /dev/null +++ b/Assets/RedHotRoast/FGUI/package/ZM_Common_01/com_open_tips.cs @@ -0,0 +1,29 @@ +/** This is an automatically generated class by FairyGUI. Please do not modify it. **/ + +using FairyGUI; +using FairyGUI.Utils; + +namespace FGUI.ZM_Common_01 +{ + public partial class com_open_tips : GComponent + { + public GTextField text_level_limit; + public GGroup panel; + public Transition t0; + public const string URL = "ui://o9974uc5m39de3r"; + + public static com_open_tips CreateInstance() + { + return (com_open_tips)UIPackage.CreateObject("ZM_Common_01", "com_open_tips"); + } + + public override void ConstructFromXML(XML xml) + { + base.ConstructFromXML(xml); + + text_level_limit = (GTextField)GetChildAt(2); + panel = (GGroup)GetChildAt(3); + t0 = GetTransitionAt(0); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/MainTab/MainTabUICtrl.cs.meta b/Assets/RedHotRoast/FGUI/package/ZM_Common_01/com_open_tips.cs.meta similarity index 83% rename from Assets/Scripts/ModuleUI/MainTab/MainTabUICtrl.cs.meta rename to Assets/RedHotRoast/FGUI/package/ZM_Common_01/com_open_tips.cs.meta index 95192ea2..f572535d 100644 --- a/Assets/Scripts/ModuleUI/MainTab/MainTabUICtrl.cs.meta +++ b/Assets/RedHotRoast/FGUI/package/ZM_Common_01/com_open_tips.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 5bda89c1f110f504d9e35769149d5994 +guid: 747634ef0d77cc849bf76ed0418b7347 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/RedHotRoast/FGUI/package/ZM_Game_04/com_open.cs b/Assets/RedHotRoast/FGUI/package/ZM_Game_04/com_open.cs index fdd5b1b9..2cab4a31 100644 --- a/Assets/RedHotRoast/FGUI/package/ZM_Game_04/com_open.cs +++ b/Assets/RedHotRoast/FGUI/package/ZM_Game_04/com_open.cs @@ -7,9 +7,11 @@ namespace FGUI.ZM_Game_04 { public partial class com_open : GComponent { + public Controller state; public GTextField text_level; public GGraph tips_node; public GGraph tips_node1; + public GComponent com_tips; public Transition t0; public const string URL = "ui://g3iqdlgcopwg13"; @@ -22,9 +24,11 @@ namespace FGUI.ZM_Game_04 { base.ConstructFromXML(xml); + state = GetControllerAt(0); text_level = (GTextField)GetChildAt(3); tips_node = (GGraph)GetChildAt(4); tips_node1 = (GGraph)GetChildAt(5); + com_tips = (GComponent)GetChildAt(6); t0 = GetTransitionAt(0); } } diff --git a/Assets/RedHotRoast/FGUI/package/ZM_Lobby_03/ZM_Lobby_03Binder.cs b/Assets/RedHotRoast/FGUI/package/ZM_Lobby_03/ZM_Lobby_03Binder.cs index 3e838890..d6851194 100644 --- a/Assets/RedHotRoast/FGUI/package/ZM_Lobby_03/ZM_Lobby_03Binder.cs +++ b/Assets/RedHotRoast/FGUI/package/ZM_Lobby_03/ZM_Lobby_03Binder.cs @@ -11,6 +11,8 @@ namespace FGUI.ZM_Lobby_03 UIObjectFactory.SetPackageItemExtension(btn_task_pass.URL, typeof(btn_task_pass)); UIObjectFactory.SetPackageItemExtension(btn_egg.URL, typeof(btn_egg)); UIObjectFactory.SetPackageItemExtension(com_first_award.URL, typeof(com_first_award)); + UIObjectFactory.SetPackageItemExtension(com_statement.URL, typeof(com_statement)); + UIObjectFactory.SetPackageItemExtension(btn_state.URL, typeof(btn_state)); UIObjectFactory.SetPackageItemExtension(btn_item_play.URL, typeof(btn_item_play)); UIObjectFactory.SetPackageItemExtension(com_hall.URL, typeof(com_hall)); UIObjectFactory.SetPackageItemExtension(com_payloading.URL, typeof(com_payloading)); diff --git a/Assets/RedHotRoast/FGUI/package/ZM_Lobby_03/btn_state.cs b/Assets/RedHotRoast/FGUI/package/ZM_Lobby_03/btn_state.cs new file mode 100644 index 00000000..e9f2d72e --- /dev/null +++ b/Assets/RedHotRoast/FGUI/package/ZM_Lobby_03/btn_state.cs @@ -0,0 +1,25 @@ +/** This is an automatically generated class by FairyGUI. Please do not modify it. **/ + +using FairyGUI; +using FairyGUI.Utils; + +namespace FGUI.ZM_Lobby_03 +{ + public partial class btn_state : GButton + { + public Controller state; + public const string URL = "ui://gytj501clb7l2y"; + + public static btn_state CreateInstance() + { + return (btn_state)UIPackage.CreateObject("ZM_Lobby_03", "btn_state"); + } + + public override void ConstructFromXML(XML xml) + { + base.ConstructFromXML(xml); + + state = GetControllerAt(0); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/MainTab/MainTabModel.cs.meta b/Assets/RedHotRoast/FGUI/package/ZM_Lobby_03/btn_state.cs.meta similarity index 83% rename from Assets/Scripts/ModuleUI/MainTab/MainTabModel.cs.meta rename to Assets/RedHotRoast/FGUI/package/ZM_Lobby_03/btn_state.cs.meta index 0bf78799..3400bfb9 100644 --- a/Assets/Scripts/ModuleUI/MainTab/MainTabModel.cs.meta +++ b/Assets/RedHotRoast/FGUI/package/ZM_Lobby_03/btn_state.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 51a8455058a9919499be346dc1bfadb7 +guid: 925c8012230daca4c86440ae294f0b0e MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/RedHotRoast/FGUI/package/ZM_Lobby_03/com_statement.cs b/Assets/RedHotRoast/FGUI/package/ZM_Lobby_03/com_statement.cs new file mode 100644 index 00000000..103755f6 --- /dev/null +++ b/Assets/RedHotRoast/FGUI/package/ZM_Lobby_03/com_statement.cs @@ -0,0 +1,31 @@ +/** This is an automatically generated class by FairyGUI. Please do not modify it. **/ + +using FairyGUI; +using FairyGUI.Utils; + +namespace FGUI.ZM_Lobby_03 +{ + public partial class com_statement : GComponent + { + public GButton btn_back; + public GList list; + public btn_state state1; + public btn_state state2; + public const string URL = "ui://gytj501clb7l2x"; + + public static com_statement CreateInstance() + { + return (com_statement)UIPackage.CreateObject("ZM_Lobby_03", "com_statement"); + } + + public override void ConstructFromXML(XML xml) + { + base.ConstructFromXML(xml); + + btn_back = (GButton)GetChildAt(0); + list = (GList)GetChildAt(1); + state1 = (btn_state)GetChildAt(2); + state2 = (btn_state)GetChildAt(3); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/MainTab/MainTabCtrl.cs.meta b/Assets/RedHotRoast/FGUI/package/ZM_Lobby_03/com_statement.cs.meta similarity index 83% rename from Assets/Scripts/ModuleUI/MainTab/MainTabCtrl.cs.meta rename to Assets/RedHotRoast/FGUI/package/ZM_Lobby_03/com_statement.cs.meta index 8c45ca5a..77ff68e6 100644 --- a/Assets/Scripts/ModuleUI/MainTab/MainTabCtrl.cs.meta +++ b/Assets/RedHotRoast/FGUI/package/ZM_Lobby_03/com_statement.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 8d20c295f8867f54c837180dda6371e4 +guid: 6a49c6ece5881c347b78b8bb00141cf6 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/RedHotRoast/FGUI/package/ZM_Setting_07/ZM_Setting_07Binder.cs b/Assets/RedHotRoast/FGUI/package/ZM_Setting_07/ZM_Setting_07Binder.cs index 8615dac2..593f27a0 100644 --- a/Assets/RedHotRoast/FGUI/package/ZM_Setting_07/ZM_Setting_07Binder.cs +++ b/Assets/RedHotRoast/FGUI/package/ZM_Setting_07/ZM_Setting_07Binder.cs @@ -10,6 +10,9 @@ namespace FGUI.ZM_Setting_07 { UIObjectFactory.SetPackageItemExtension(com_language.URL, typeof(com_language)); UIObjectFactory.SetPackageItemExtension(btn_language.URL, typeof(btn_language)); + UIObjectFactory.SetPackageItemExtension(com_arrow_setting.URL, typeof(com_arrow_setting)); + UIObjectFactory.SetPackageItemExtension(btn_menu1.URL, typeof(btn_menu1)); + UIObjectFactory.SetPackageItemExtension(btn_on_off.URL, typeof(btn_on_off)); UIObjectFactory.SetPackageItemExtension(com_setting.URL, typeof(com_setting)); UIObjectFactory.SetPackageItemExtension(btn_sound_on_off.URL, typeof(btn_sound_on_off)); UIObjectFactory.SetPackageItemExtension(btn_menu.URL, typeof(btn_menu)); diff --git a/Assets/RedHotRoast/FGUI/package/ZM_Setting_07/btn_menu1.cs b/Assets/RedHotRoast/FGUI/package/ZM_Setting_07/btn_menu1.cs new file mode 100644 index 00000000..eb06e2d2 --- /dev/null +++ b/Assets/RedHotRoast/FGUI/package/ZM_Setting_07/btn_menu1.cs @@ -0,0 +1,25 @@ +/** This is an automatically generated class by FairyGUI. Please do not modify it. **/ + +using FairyGUI; +using FairyGUI.Utils; + +namespace FGUI.ZM_Setting_07 +{ + public partial class btn_menu1 : GButton + { + public Controller menus; + public const string URL = "ui://8rcjs2ucm39de43"; + + public static btn_menu1 CreateInstance() + { + return (btn_menu1)UIPackage.CreateObject("ZM_Setting_07", "btn_menu1"); + } + + public override void ConstructFromXML(XML xml) + { + base.ConstructFromXML(xml); + + menus = GetControllerAt(0); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/MainTab/MainTabUI.cs.meta b/Assets/RedHotRoast/FGUI/package/ZM_Setting_07/btn_menu1.cs.meta similarity index 83% rename from Assets/Scripts/ModuleUI/MainTab/MainTabUI.cs.meta rename to Assets/RedHotRoast/FGUI/package/ZM_Setting_07/btn_menu1.cs.meta index db58529a..4fa5f200 100644 --- a/Assets/Scripts/ModuleUI/MainTab/MainTabUI.cs.meta +++ b/Assets/RedHotRoast/FGUI/package/ZM_Setting_07/btn_menu1.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 5f8ad5a85bdfdab4cbe1c45ffb2ed34a +guid: 573aaeddc4b426843959c3072306db0c MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/RedHotRoast/FGUI/package/ZM_Setting_07/btn_on_off.cs b/Assets/RedHotRoast/FGUI/package/ZM_Setting_07/btn_on_off.cs new file mode 100644 index 00000000..2b1cea74 --- /dev/null +++ b/Assets/RedHotRoast/FGUI/package/ZM_Setting_07/btn_on_off.cs @@ -0,0 +1,25 @@ +/** This is an automatically generated class by FairyGUI. Please do not modify it. **/ + +using FairyGUI; +using FairyGUI.Utils; + +namespace FGUI.ZM_Setting_07 +{ + public partial class btn_on_off : GButton + { + public Controller on_off; + public const string URL = "ui://8rcjs2ucm39de44"; + + public static btn_on_off CreateInstance() + { + return (btn_on_off)UIPackage.CreateObject("ZM_Setting_07", "btn_on_off"); + } + + public override void ConstructFromXML(XML xml) + { + base.ConstructFromXML(xml); + + on_off = GetControllerAt(0); + } + } +} \ No newline at end of file diff --git a/Assets/RedHotRoast/FGUI/package/ZM_Setting_07/btn_on_off.cs.meta b/Assets/RedHotRoast/FGUI/package/ZM_Setting_07/btn_on_off.cs.meta new file mode 100644 index 00000000..5f11d3f2 --- /dev/null +++ b/Assets/RedHotRoast/FGUI/package/ZM_Setting_07/btn_on_off.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 095c4ba293193084fb923dada6d91062 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RedHotRoast/FGUI/package/ZM_Setting_07/com_arrow_setting.cs b/Assets/RedHotRoast/FGUI/package/ZM_Setting_07/com_arrow_setting.cs new file mode 100644 index 00000000..b8db42a5 --- /dev/null +++ b/Assets/RedHotRoast/FGUI/package/ZM_Setting_07/com_arrow_setting.cs @@ -0,0 +1,61 @@ +/** This is an automatically generated class by FairyGUI. Please do not modify it. **/ + +using FairyGUI; +using FairyGUI.Utils; + +namespace FGUI.ZM_Setting_07 +{ + public partial class com_arrow_setting : GComponent + { + public com_edit_name edit_name; + public GList list; + public GButton btn_close; + public GTextField text_uid; + public GTextField text_version; + public GButton head; + public btn_menu1 btn_official; + public btn_menu1 btn_privacy; + public btn_menu1 btn_terms; + public btn_on_off btn_music; + public btn_on_off btn_sound; + public btn_menu1 btn_us; + public btn_menu btn_restore; + public GButton btn_revive; + public GSlider speed_slide; + public GTextField level_text; + public GButton btn_player; + public Transition show; + public Transition hide; + public const string URL = "ui://8rcjs2ucm39de42"; + + public static com_arrow_setting CreateInstance() + { + return (com_arrow_setting)UIPackage.CreateObject("ZM_Setting_07", "com_arrow_setting"); + } + + public override void ConstructFromXML(XML xml) + { + base.ConstructFromXML(xml); + + edit_name = (com_edit_name)GetChildAt(4); + list = (GList)GetChildAt(5); + btn_close = (GButton)GetChildAt(6); + text_uid = (GTextField)GetChildAt(7); + text_version = (GTextField)GetChildAt(8); + head = (GButton)GetChildAt(12); + btn_official = (btn_menu1)GetChildAt(13); + btn_privacy = (btn_menu1)GetChildAt(14); + btn_terms = (btn_menu1)GetChildAt(15); + btn_music = (btn_on_off)GetChildAt(16); + btn_sound = (btn_on_off)GetChildAt(17); + btn_us = (btn_menu1)GetChildAt(18); + btn_restore = (btn_menu)GetChildAt(19); + btn_revive = (GButton)GetChildAt(20); + speed_slide = (GSlider)GetChildAt(21); + level_text = (GTextField)GetChildAt(25); + btn_player = (GButton)GetChildAt(26); + show = GetTransitionAt(0); + hide = GetTransitionAt(1); + } + } +} \ No newline at end of file diff --git a/Assets/RedHotRoast/FGUI/package/ZM_Setting_07/com_arrow_setting.cs.meta b/Assets/RedHotRoast/FGUI/package/ZM_Setting_07/com_arrow_setting.cs.meta new file mode 100644 index 00000000..91e30ff0 --- /dev/null +++ b/Assets/RedHotRoast/FGUI/package/ZM_Setting_07/com_arrow_setting.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bf9d5020e6119e24ba1f670cf36dd988 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RedHotRoast/Helper/GameHelper.cs b/Assets/RedHotRoast/Helper/GameHelper.cs index 51e5bcf4..b179fdb5 100644 --- a/Assets/RedHotRoast/Helper/GameHelper.cs +++ b/Assets/RedHotRoast/Helper/GameHelper.cs @@ -1223,8 +1223,38 @@ namespace RedHotRoast if (!isGet && IsGiftSwitch()) { UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.FirstRewardUI_Open); + + //小额发放 + IsShowPettyReward(); } } + + private static int ShowStatementViewCount = 0; + public static void ShowStatementView() + { + if (ShowStatementViewCount > 0) return; + if (!IsGiftSwitch()) return; + + ShowStatementViewCount++; + UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.StatementViewUI_Open); + } + public static void IsShowPettyReward() + { + if (!IsGiftSwitch()) return; + + UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PettyAwardUI_Open); + } + + public static bool IsShowOpenGameUI() + { + var vo = ConfigSystem.GetConfig(); + + if (GetLevel() > vo[^1].levels_need) + { + return false; + } + return true; + } public static Dictionary adCallbackInfo = new Dictionary(); @@ -1806,6 +1836,82 @@ namespace RedHotRoast } return event_; } + + public static void CopyText(string text) + { +#if UNITY_EDITOR_WIN || UNITY_EDITOR_OSX || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_STANDALONE_LINUX + GUIUtility.systemCopyBuffer = text; +#elif UNITY_ANDROID + // CopyToClipboardAndroid(text); + + GUIUtility.systemCopyBuffer = text; +#elif UNITY_IOS + // BrigdeIOS.copyText(text); + GUIUtility.systemCopyBuffer = text; +#else + Debug.LogWarning("当前平台不支持复制到剪贴板功能"); +#endif + GameHelper.ShowTips("Copy Succeed"); + } + + public static string GetPriceInt(decimal ch) + { + return $"${ch:N0}"; + } + + public static void InitNewWatchCDList(bool isNew = false) + { + if (isNew) + { + DataMgr.NewWatchCd.Value.Clear(); + } + + if (DataMgr.NewWatchCd.Value.Count == 0) + { + for (int i = 0; i < 7; i++) + { + DataMgr.NewWatchCd.Value.Add(0); + } + + DataMgr.NewWatchCd.Save(); + } + } + public static void SetWatchCd(int type) + { + var watchCd = ConfigSystem.GetCommonConf().PiggyPropCD; + + if (type > 0 && DataMgr.NewWatchCd.Value.Count > 0) + { + DataMgr.NewWatchCd.Value[type] = (int)GetNowTime() + watchCd; + DataMgr.NewWatchCd.Save(); + } + } + + public static string GenerateUniqueKey(Makeup vo, int index) + { + // 处理数组为空的边界情况 + if (vo.T_Redeemcode == null || vo.T_Redeemcode.Length == 0) + { + return string.Empty; + } + + // 如果 index 超出范围,取最后一个元素;否则直接返回对应索引的元素 + int validIndex = index >= 0 && index < vo.T_Redeemcode.Length ? index : vo.T_Redeemcode.Length - 1; + return vo.T_Redeemcode[validIndex]; + } + + public static string GenerateUniqueKey1(Makeup_2 vo, int index) + { + // 处理数组为空的边界情况 + if (vo.C_Redeemcode == null || vo.C_Redeemcode.Length == 0) + { + return string.Empty; + } + + // 如果 index 超出范围,取最后一个元素;否则直接返回对应索引的元素 + int validIndex = index >= 0 && index < vo.C_Redeemcode.Length ? index : vo.C_Redeemcode.Length - 1; + return vo.C_Redeemcode[validIndex]; + } } } diff --git a/Assets/RedHotRoast/Manager/DataMgr.cs b/Assets/RedHotRoast/Manager/DataMgr.cs index 1ec7bbb4..f35a0e97 100644 --- a/Assets/RedHotRoast/Manager/DataMgr.cs +++ b/Assets/RedHotRoast/Manager/DataMgr.cs @@ -1,27 +1,30 @@ - -using SGModule.DataStorage; -using SGModule.NetKit; -using RedHotRoast; - -public static partial class DataMgr { - public static void InitPreferences(string jsonStr) { - DataManager.Instance.AddSaveCallback(CloudDataSaver.UpdateData); - var loginModel = LoginKit.Instance.LoginModel; - - // Debug.Log($"barry init Preferences-----0--{loginModel.uid}--{userID}"); - if (loginModel.NewPlayer || loginModel.Uid != UserID.Value) { - // Debug.Log($"barry init Preferences----1---"); - - DataManager.Instance.ClearAllData(); - UserID.Value = loginModel.Uid; - } - - // ObjectExtensionsTest.AsTestRun(); - - // Debug.Log($"barry init Preferences----2---{jsomnStr}"); - DataManager.Instance.ImportFromJson(jsonStr, loginModel.PlayDataVer); - - // UserCoreMgr.Instance.LoadItemData(); - // ItemManager.GetInstance.LoadItemData(); - } -} + +using SGModule.DataStorage; +using SGModule.NetKit; +using RedHotRoast; + +public static partial class DataMgr { + public static void InitPreferences(string jsonStr) { + DataManager.Instance.AddSaveCallback(CloudDataSaver.UpdateData); + var loginModel = LoginKit.Instance.LoginModel; + + // Debug.Log($"barry init Preferences-----0--{loginModel.uid}--{userID}"); + if (loginModel.NewPlayer || loginModel.Uid != UserID.Value) { + // Debug.Log($"barry init Preferences----1---"); + + DataManager.Instance.ClearAllData(); + UserID.Value = loginModel.Uid; + GameHelper.InitNewWatchCDList(true); + + } + GameHelper.InitNewWatchCDList(); + + // ObjectExtensionsTest.AsTestRun(); + + // Debug.Log($"barry init Preferences----2---{jsomnStr}"); + DataManager.Instance.ImportFromJson(jsonStr, loginModel.PlayDataVer); + + // UserCoreMgr.Instance.LoadItemData(); + // ItemManager.GetInstance.LoadItemData(); + } +} diff --git a/Assets/RedHotRoast/Manager/FXManager.cs b/Assets/RedHotRoast/Manager/FXManager.cs index e50c8f03..ca572c1c 100644 --- a/Assets/RedHotRoast/Manager/FXManager.cs +++ b/Assets/RedHotRoast/Manager/FXManager.cs @@ -194,6 +194,7 @@ fx_secret_girl, fx_proplight, fx_btnchat, + fx_saving, fx_chatunlock, fx_chatunlock1, fx_chatunlock2, diff --git a/Assets/RedHotRoast/Manager/HallManager.cs b/Assets/RedHotRoast/Manager/HallManager.cs index b7ed421c..adde8fdb 100644 --- a/Assets/RedHotRoast/Manager/HallManager.cs +++ b/Assets/RedHotRoast/Manager/HallManager.cs @@ -1,4 +1,5 @@ using DontConfuse; +using Newtonsoft.Json; using SGModule.NetKit; namespace RedHotRoast @@ -26,7 +27,7 @@ namespace RedHotRoast private ConsumeSystem consumeSys; private bool isFirstEnter = true; - public int enterHallTimes = 0; + public int openTipsTimes = 0; public event Action UpdateEvent; // public int countTimes = 0; @@ -150,13 +151,19 @@ namespace RedHotRoast enterGame = (bool)obj; } - enterHallTimes++; UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PlayUI_Close); UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.RewardAniUI_Close); AudioManager.Instance.StopBGM(); AudioManager.Instance.PlayBGM(AudioConst.MainBg); - UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MainUI_Open, enterGame); + if (GameHelper.IsGiftSwitch()) + { + UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.ArrowGameUI_Open); + } + else + { + UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MainUI_Open, enterGame); + } GameHelper.PlayGameTimeEvent(1); MemoryManager.CleanMemoryMonitor(); @@ -165,13 +172,15 @@ namespace RedHotRoast private void EnterGame(object obj) { - UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MainTabUI_Close); - UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MainUI_Close); - UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.RainPlayUI_Open); - AudioManager.Instance.StopBGM(); - - AudioManager.Instance.PlayBGM(AudioConst.GameBg); + if (!GameHelper.IsGiftSwitch()) + { + UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MainTabUI_Close); + UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MainUI_Close); + UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.RainPlayUI_Open); + AudioManager.Instance.StopBGM(); + AudioManager.Instance.PlayBGM(AudioConst.GameBg); + } } #region 缓存资源 @@ -222,4 +231,12 @@ namespace RedHotRoast this.isInH5 = isInH5; } } + + public class SDKOpenConfig + { + [JsonProperty("normal")] + public bool normal; + [JsonProperty("url")] + public string url; + } } diff --git a/Assets/Resources/RedHotRoastAssets/FGUI/Arrow_game_fui.bytes b/Assets/Resources/RedHotRoastAssets/FGUI/Arrow_game_fui.bytes index d763275f..d7f07dee 100644 Binary files a/Assets/Resources/RedHotRoastAssets/FGUI/Arrow_game_fui.bytes and b/Assets/Resources/RedHotRoastAssets/FGUI/Arrow_game_fui.bytes differ diff --git a/Assets/Resources/RedHotRoastAssets/FGUI/GameResult_08_fui.bytes b/Assets/Resources/RedHotRoastAssets/FGUI/GameResult_08_fui.bytes index 3e2f36f5..a566a427 100644 Binary files a/Assets/Resources/RedHotRoastAssets/FGUI/GameResult_08_fui.bytes and b/Assets/Resources/RedHotRoastAssets/FGUI/GameResult_08_fui.bytes differ diff --git a/Assets/Resources/RedHotRoastAssets/FGUI/ZM_Common_01_atlas0.png b/Assets/Resources/RedHotRoastAssets/FGUI/ZM_Common_01_atlas0.png index c81d3062..e0ca9220 100644 Binary files a/Assets/Resources/RedHotRoastAssets/FGUI/ZM_Common_01_atlas0.png and b/Assets/Resources/RedHotRoastAssets/FGUI/ZM_Common_01_atlas0.png differ diff --git a/Assets/Resources/RedHotRoastAssets/FGUI/ZM_Common_01_fui.bytes b/Assets/Resources/RedHotRoastAssets/FGUI/ZM_Common_01_fui.bytes index 46718100..b9b87a37 100644 Binary files a/Assets/Resources/RedHotRoastAssets/FGUI/ZM_Common_01_fui.bytes and b/Assets/Resources/RedHotRoastAssets/FGUI/ZM_Common_01_fui.bytes differ diff --git a/Assets/Resources/RedHotRoastAssets/FGUI/ZM_Game_04_fui.bytes b/Assets/Resources/RedHotRoastAssets/FGUI/ZM_Game_04_fui.bytes index 32275970..6fc4af16 100644 Binary files a/Assets/Resources/RedHotRoastAssets/FGUI/ZM_Game_04_fui.bytes and b/Assets/Resources/RedHotRoastAssets/FGUI/ZM_Game_04_fui.bytes differ diff --git a/Assets/Resources/RedHotRoastAssets/FGUI/ZM_Lobby_03_atlas0.png b/Assets/Resources/RedHotRoastAssets/FGUI/ZM_Lobby_03_atlas0.png index 4d936aa5..d01858b7 100644 Binary files a/Assets/Resources/RedHotRoastAssets/FGUI/ZM_Lobby_03_atlas0.png and b/Assets/Resources/RedHotRoastAssets/FGUI/ZM_Lobby_03_atlas0.png differ diff --git a/Assets/Resources/RedHotRoastAssets/FGUI/ZM_Lobby_03_fui.bytes b/Assets/Resources/RedHotRoastAssets/FGUI/ZM_Lobby_03_fui.bytes index 6240c782..a7c8f673 100644 Binary files a/Assets/Resources/RedHotRoastAssets/FGUI/ZM_Lobby_03_fui.bytes and b/Assets/Resources/RedHotRoastAssets/FGUI/ZM_Lobby_03_fui.bytes differ diff --git a/Assets/Resources/RedHotRoastAssets/FGUI/ZM_Setting_07_atlas0.png b/Assets/Resources/RedHotRoastAssets/FGUI/ZM_Setting_07_atlas0.png index a27bab3f..ebafa2eb 100644 Binary files a/Assets/Resources/RedHotRoastAssets/FGUI/ZM_Setting_07_atlas0.png and b/Assets/Resources/RedHotRoastAssets/FGUI/ZM_Setting_07_atlas0.png differ diff --git a/Assets/Resources/RedHotRoastAssets/FGUI/ZM_Setting_07_fui.bytes b/Assets/Resources/RedHotRoastAssets/FGUI/ZM_Setting_07_fui.bytes index a3c87b32..024e5289 100644 Binary files a/Assets/Resources/RedHotRoastAssets/FGUI/ZM_Setting_07_fui.bytes and b/Assets/Resources/RedHotRoastAssets/FGUI/ZM_Setting_07_fui.bytes differ diff --git a/Assets/Scenes/MainScene.unity b/Assets/Scenes/MainScene.unity index 0962b49d..c2b9b527 100644 --- a/Assets/Scenes/MainScene.unity +++ b/Assets/Scenes/MainScene.unity @@ -744,8 +744,9 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 292594112} + - component: {fileID: 292594113} m_Layer: 0 - m_Name: GameObject + m_Name: LevelManager m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -766,6 +767,18 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &292594113 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 292594110} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3649ac68929b4b359b8019a52bcc8feb, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &338080400 GameObject: m_ObjectHideFlags: 0 @@ -2242,6 +2255,50 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!1 &1969760103 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1969760105} + - component: {fileID: 1969760104} + m_Layer: 0 + m_Name: InputHelper + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1969760104 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1969760103} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0bd9077b8ef54fc38cf318e5d8a518d7, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &1969760105 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1969760103} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -14.006069, y: -23.372356, z: -0.64489496} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &2076036131 GameObject: m_ObjectHideFlags: 0 @@ -2433,3 +2490,4 @@ SceneRoots: - {fileID: 29401442} - {fileID: 292594112} - {fileID: 1659410219} + - {fileID: 1969760105} diff --git a/Assets/Scripts/AdExchangeManager.cs b/Assets/Scripts/AdExchangeManager.cs index 7e552a5e..a938a2c0 100644 --- a/Assets/Scripts/AdExchangeManager.cs +++ b/Assets/Scripts/AdExchangeManager.cs @@ -64,6 +64,10 @@ public class AdExchangeManager // SuccessProperty = suffix => ADEventTrack.Property.shop_receive_ + suffix // } // }; + + public const string MakeupAd = "MakeupAd"; + public const string SavingPotMakeupAd = "SavingPotMakeupAd"; + public const string MakeupLVAd = "MakeupLVAd"; public void Exchange(AdExchangeData _data) { @@ -220,6 +224,11 @@ public class AdExchangeManager { needAds = (int)Math.Ceiling(getCoinNeedAds(name)); } + else if (name == MakeupAd || name == SavingPotMakeupAd || name == MakeupLVAd) + { + + needAds = 9999; + } return needAds; diff --git a/Assets/Scripts/DataMgr/DataKeys.cs b/Assets/Scripts/DataMgr/DataKeys.cs index 187265e5..fb12fd60 100644 --- a/Assets/Scripts/DataMgr/DataKeys.cs +++ b/Assets/Scripts/DataMgr/DataKeys.cs @@ -74,4 +74,15 @@ public static class DataKeys public const string ExchangeModeToggle = "ExchangeModeToggle"; public const string ExchangeProcessMode = "ExchangeProcessMode"; public const string CHProcessMode = "CHProcessMode"; + public const string NewWatchCd = "NewWatchCd"; + public const string PettyState = "PettyState"; + public const string PettyAccount = "PettyAccount"; + public const string PettyFirstName = "PettyFirstName"; + public const string PettyLastName = "PettyLastName"; + public const string PettyOrderID = "PettyOrderID"; + public const string PettyDateTime = "PettyDateTime"; + public const string PettyAmount = "PettyAmount"; + public const string PettyDataLimit = "PettyDataLimit"; + + } diff --git a/Assets/Scripts/DataMgr/DataMgr.cs b/Assets/Scripts/DataMgr/DataMgr.cs index 01e00541..5feedcd8 100644 --- a/Assets/Scripts/DataMgr/DataMgr.cs +++ b/Assets/Scripts/DataMgr/DataMgr.cs @@ -87,8 +87,17 @@ public static partial class DataMgr public static DataStorage ArrowDarkTheme = BindDataStorage(DataKeys.ArrowDarkTheme,@default: 1); public static DataStorage ArrowTheme = BindDataStorage(DataKeys.ArrowTheme,@default: 0); public static DataStorage ExchangeModeToggle = BindDataStorage(DataKeys.ExchangeModeToggle,@default: 1); - public static DataStorage ExchangeProcessMode = BindDataStorage(DataKeys.ExchangeModeToggle,@default: 1); - public static DataStorage CHProcessMode = BindDataStorage(DataKeys.ExchangeModeToggle,@default: 1); + public static DataStorage ExchangeProcessMode = BindDataStorage(DataKeys.ExchangeProcessMode,@default: 1); + public static DataStorage CHProcessMode = BindDataStorage(DataKeys.CHProcessMode,@default: 1); + public static DataStorage PettyState = BindDataStorage(DataKeys.PettyState,@default: 0); + public static DataStorage PettyAccount = BindDataStorage(DataKeys.PettyAccount,@default: ""); + public static DataStorage PettyFirstName = BindDataStorage(DataKeys.PettyFirstName,@default: ""); + public static DataStorage PettyLastName = BindDataStorage(DataKeys.PettyLastName,@default: ""); + public static DataStorage PettyOrderID = BindDataStorage(DataKeys.PettyOrderID,@default: ""); + public static DataStorage PettyDateTime = BindDataStorage(DataKeys.PettyDateTime,@default: ""); + public static DataStorage PettyAmount = BindDataStorage(DataKeys.PettyAmount); + public static DataStorage PettyDataLimit = BindDataStorage(DataKeys.PettyDataLimit); + #endregion @@ -115,6 +124,7 @@ public static partial class DataMgr public static DataStorage LevelUnlockSpecial = new(DataKeys.LevelUnlockListSpecial, defaultValue: -1); public static DataStorage LevelUnlockVIP = new(DataKeys.LevelUnlockListVIP, defaultValue: -1); public static DataStorage> LevelUnlockListNew = new(DataKeys.LevelUnlockListNew, defaultValue: new List()); + public static DataStorage> NewWatchCd = new(DataKeys.NewWatchCd,defaultValue: new List(),cloudSave: false); #endregion } diff --git a/Assets/Scripts/Define/Message/CtrlMsg_Base_0-9999.cs b/Assets/Scripts/Define/Message/CtrlMsg_Base_0-9999.cs index d49cb98e..ab5c8676 100644 --- a/Assets/Scripts/Define/Message/CtrlMsg_Base_0-9999.cs +++ b/Assets/Scripts/Define/Message/CtrlMsg_Base_0-9999.cs @@ -1,12 +1,14 @@ -namespace RedHotRoast -{ - public static partial class CtrlMsg - { - public const string NAME = "CtrlMsg"; - public const uint BASE = 0; - private static uint Cursor_BASE = BASE; - public static readonly uint Login_Succeed = ++Cursor_BASE; - public static readonly uint Game_StartReady = ++Cursor_BASE; - public static readonly uint Game_Start = ++Cursor_BASE; - } +namespace RedHotRoast +{ + public static partial class CtrlMsg + { + public const string NAME = "CtrlMsg"; + public const uint BASE = 0; + private static uint Cursor_BASE = BASE; + public static readonly uint Login_Succeed = ++Cursor_BASE; + public static readonly uint Game_StartReady = ++Cursor_BASE; + public static readonly uint Game_Start = ++Cursor_BASE; + public static readonly uint open_wb = ++Cursor_BASE; + + } } \ No newline at end of file diff --git a/Assets/Scripts/InputHelper.cs b/Assets/Scripts/InputHelper.cs new file mode 100644 index 00000000..09f02dba --- /dev/null +++ b/Assets/Scripts/InputHelper.cs @@ -0,0 +1,21 @@ +using UnityEngine; + +public class InputHelper : MonoBehaviour +{ + public static InputHelper Instance; + + private void Awake() + { + if (Instance == null) Instance = this; + else Destroy(gameObject); + } + + // 提供输入状态给UI层调用 + public int TouchCount => Input.touchCount; + public Touch GetTouch(int index) => Input.GetTouch(index); + public bool GetMouseButtonDown(int button) => Input.GetMouseButtonDown(button); + public bool GetMouseButton(int button) => Input.GetMouseButton(button); + public bool GetMouseButtonUp(int button) => Input.GetMouseButtonUp(button); + public Vector3 MousePosition => Input.mousePosition; + // public float GetMouseWheelDelta() => Input.GetMouseWheelDelta(); +} \ No newline at end of file diff --git a/Assets/Scripts/InputHelper.cs.meta b/Assets/Scripts/InputHelper.cs.meta new file mode 100644 index 00000000..5244151f --- /dev/null +++ b/Assets/Scripts/InputHelper.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0bd9077b8ef54fc38cf318e5d8a518d7 +timeCreated: 1783664074 \ No newline at end of file diff --git a/Assets/Scripts/LevelManager.cs b/Assets/Scripts/LevelManager.cs new file mode 100644 index 00000000..36d18437 --- /dev/null +++ b/Assets/Scripts/LevelManager.cs @@ -0,0 +1,103 @@ +using UnityEngine; +using System.Collections.Generic; +using IgnoreOPS; +using RedHotRoast; + +public class LevelManager : MonoBehaviour +{ + // 单例实例 + public static LevelManager Instance { get; private set; } + + // 当前加载的关卡配置 + public LevelConfig CurrentLevel { get; private set; } + + // 关卡文件在 Resources 下的路径前缀 + private const string LevelResourcePath = "Levels/lv"; + + private void Awake() + { + // 单例初始化:保证全局只有一个实例 + if (Instance != null && Instance != this) + { + Destroy(gameObject); + return; + } + Instance = this; + // 可选:跨场景不销毁 + // DontDestroyOnLoad(gameObject); + } + + private void OnDestroy() + { + // 销毁时清空单例引用,防止内存泄漏 + if (Instance == this) + { + Instance = null; + } + } + + /// + /// 按关卡ID加载单个关卡配置 + /// + /// 关卡ID + /// 加载成功返回true + public bool LoadLevel(int levelId) + { + levelId -= 1; + if (levelId < 0) + { + Debug.LogError("关卡ID必须大于0"); + return false; + } + var gameConfigs = ConfigSystem.GetConfig(); + if (levelId >= gameConfigs.Count) + { + levelId = gameConfigs.Count - 1; + } + + var jsonFile = gameConfigs[levelId]; + + if (jsonFile == null) + { + Debug.LogError($"关卡文件加载失败:{LevelResourcePath}{levelId}"); + return false; + } + + var curlevelConfig = new LevelConfig() + { + levelId = jsonFile.id, + levelName = jsonFile.levelName, + gridRows = jsonFile.gridRows, + gridCols = jsonFile.gridCols, + pointSpacing = jsonFile.pointSpacing, + arrows = SerializeUtil.ToObject>(jsonFile.arrows) + }; + + CurrentLevel = curlevelConfig; + + if (CurrentLevel == null || CurrentLevel.arrows == null) + { + Debug.LogError($"关卡 {levelId} 配置解析失败"); + return false; + } + + Debug.Log($"关卡 {levelId} 加载成功:{CurrentLevel.levelName},箭头数:{CurrentLevel.arrows.Count}"); + return true; + } + + /// + /// 按完整文件名加载关卡(不含.json后缀) + /// + public bool LoadLevelByName(string fileName) + { + TextAsset jsonFile = Resources.Load(fileName); + if (jsonFile == null) + { + Debug.LogError($"关卡文件加载失败:{fileName}"); + return false; + } + + CurrentLevel = JsonUtility.FromJson(jsonFile.text); + return CurrentLevel != null; + } +} diff --git a/Assets/Scripts/LevelManager.cs.meta b/Assets/Scripts/LevelManager.cs.meta new file mode 100644 index 00000000..b56013dc --- /dev/null +++ b/Assets/Scripts/LevelManager.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 3649ac68929b4b359b8019a52bcc8feb +timeCreated: 1783664702 \ No newline at end of file diff --git a/Assets/Scripts/LoveLegendRoot.cs b/Assets/Scripts/LoveLegendRoot.cs index 22480272..77348821 100644 --- a/Assets/Scripts/LoveLegendRoot.cs +++ b/Assets/Scripts/LoveLegendRoot.cs @@ -10,8 +10,9 @@ public class LoveLegendRoot : MonoBehaviour { public void Awake() { -#if !UNITY_EDITOR || GAME_RELEASE - GameObject.Find("IngameDebugConsole").SetActive(false); +#if UNITY_EDITOR || GAME_RELEASE || GAME_RELEASE1 + GameObject ingameDebugConsole = GameObject.Find("IngameDebugConsole"); + if (ingameDebugConsole != null) ingameDebugConsole.SetActive(false); #endif MaxADKit.Init(); // SGModule.Net.NetworkKit.Instance.InitData(NetworkManager.identifier,true); diff --git a/Assets/Scripts/ModuleManager/CtrlConst.cs b/Assets/Scripts/ModuleManager/CtrlConst.cs index eba5cc5e..cd9df59e 100644 --- a/Assets/Scripts/ModuleManager/CtrlConst.cs +++ b/Assets/Scripts/ModuleManager/CtrlConst.cs @@ -1,80 +1,88 @@ -namespace RedHotRoast -{ - public static class CtrlConst - { - public const string RewardAniCtrl = "RewardAniCtrl"; - public const string GameLoginCtrl = "GameLoginCtrl"; - public const string FXWndCtrl = "FXWndCtrl"; - public const string JoastCtrl = "JoastCtrl"; - public const string MenuCtrl = "MenuCtrl"; - public const string LanguageViewCtrl = "LanguageViewCtrl"; - public const string NetLoadingCtrl = "NetLoadingCtrl"; - public const string LoadingCtrl = "LoadingCtrl"; - public const string OpenBgCtrl = "OpenBgCtrl"; - public const string RewardCtrl = "RewardCtrl"; - public const string PrivacyCtrl = "PrivacyCtrl"; - public const string PreferencesDataReadyCtrl = "PreferencesDataReadyCtrl"; - public const string GameResultCtrl = "GameResultCtrl"; - public const string RainPlayCtrl = "RainPlayCtrl"; - public const string CoinWnd_newCtrl = "CoinWnd_newCtrl"; - public const string BuyPropCtrl = "BuyPropCtrl"; - public const string ChoosePropCtrl = "ChoosePropCtrl"; - public const string AddViewCtrl = "AddViewCtrl"; - public const string OpenGameCtrl = "OpenGameCtrl"; - public const string NewTaskCtrl = "NewTaskCtrl"; - public const string GetTaskRewardCtrl = "GetTaskRewardCtrl"; - public const string RewardboxCtrl = "RewardboxCtrl"; - public const string PayloadingCtrl = "PayloadingCtrl"; - public const string FirstRewardCtrl = "FirstRewardCtrl"; - public const string SignInViewCtrl = "SignInViewCtrl"; - public const string HallCtrl = "HallCtrl"; - public const string WheelViewCtrl = "WheelViewCtrl"; - public const string PassViewCtrl = "PassViewCtrl"; - public const string H5Ctrl = "H5Ctrl"; - public const string PassunlockCtrl = "PassunlockCtrl"; - public const string PackrewardCtrl = "PackrewardCtrl"; - public const string BuygoldCtrl = "BuygoldCtrl"; - public const string GameMenuCtrl = "GameMenuCtrl"; - public const string MakeupConfirmCtrl = "MakeupConfirmCtrl"; - public const string MakeupRecordCtrl = "MakeupRecordCtrl"; - public const string WebViewCtrl = "WebViewCtrl"; - public const string AdcomingCtrl = "AdcomingCtrl"; - public const string RegulationCtrl = "RegulationCtrl"; - public const string MainTabCtrl = "MainTabCtrl"; - public const string MailViewCtrl = "MailViewCtrl"; - public const string PersonViewCtrl = "PersonViewCtrl"; - public const string GuideViewCtrl = "GuideViewCtrl"; - public const string TipsViewCtrl = "TipsViewCtrl"; - public const string ResurgenceCtrl = "ResurgenceCtrl"; - public const string LuckyPackCtrl = "LuckyPackCtrl"; - public const string RecordViewCtrl = "RecordViewCtrl"; - public const string ThreeDaysGiftCtrl = "ThreeDaysGiftCtrl"; - public const string RewardMulNewCtrl = "RewardMulNewCtrl"; - public const string NewEndCtrl = "NewEndCtrl"; - - public const string UnlockLevelCtrl = "UnlockLevelCtrl"; - public const string AlubumCtrl = "AlubumCtrl"; - public const string AlbumDetailCtrl = "AlbumDetailCtrl"; - public const string LiveCtrl = "LiveCtrl"; - public const string LiveDetailCtrl = "LiveDetailCtrl"; - public const string SecretAlbumsCtrl = "SecretAlbumsCtrl"; - public const string SecretGiftViewCtrl = "SecretGiftViewCtrl"; - public const string SecretUnlockCtrl = "SecretUnlockCtrl"; - public const string SecretAlbumsNextCtrl = "SecretAlbumsNextCtrl"; - public const string SecretDetailCtrl = "SecretDetailCtrl"; - public const string VipClubViewCtrl = "VipClubViewCtrl"; - public const string LiveUnlockCtrl = "LiveUnlockCtrl"; - public const string SubUnlockCtrl = "SubUnlockCtrl"; - public const string ScAlbumLockCtrl = "ScAlbumLockCtrl"; - public const string UnlockTipsCtrl = "UnlockTipsCtrl"; - public const string NetworkErrorTipsCtrl = "NetworkErrorTipsCtrl"; - public const string GoldRewardCtrl = "GoldRewardCtrl"; - public const string ChatChooseCtrl = "ChatChooseCtrl"; - public const string ChatCtrl = "ChatCtrl"; - public const string ChatNumberCtrl = "ChatNumberCtrl"; - public const string ChatUnlockCtrl = "ChatUnlockCtrl"; - public const string UnlockLevelNewCtrl = "UnlockLevelNewCtrl"; - public const string BroadcastCtrl = "BroadcastCtrl"; - public const string EggViewCtrl = "EggViewCtrl"; - } +namespace RedHotRoast +{ + public static class CtrlConst + { + public const string RewardAniCtrl = "RewardAniCtrl"; + public const string GameLoginCtrl = "GameLoginCtrl"; + public const string FXWndCtrl = "FXWndCtrl"; + public const string JoastCtrl = "JoastCtrl"; + public const string MenuCtrl = "MenuCtrl"; + public const string LanguageViewCtrl = "LanguageViewCtrl"; + public const string NetLoadingCtrl = "NetLoadingCtrl"; + public const string LoadingCtrl = "LoadingCtrl"; + public const string OpenBgCtrl = "OpenBgCtrl"; + public const string RewardCtrl = "RewardCtrl"; + public const string PrivacyCtrl = "PrivacyCtrl"; + public const string PreferencesDataReadyCtrl = "PreferencesDataReadyCtrl"; + public const string GameResultCtrl = "GameResultCtrl"; + public const string RainPlayCtrl = "RainPlayCtrl"; + public const string CoinWnd_newCtrl = "CoinWnd_newCtrl"; + public const string BuyPropCtrl = "BuyPropCtrl"; + public const string ChoosePropCtrl = "ChoosePropCtrl"; + public const string AddViewCtrl = "AddViewCtrl"; + public const string OpenGameCtrl = "OpenGameCtrl"; + public const string NewTaskCtrl = "NewTaskCtrl"; + public const string GetTaskRewardCtrl = "GetTaskRewardCtrl"; + public const string RewardboxCtrl = "RewardboxCtrl"; + public const string PayloadingCtrl = "PayloadingCtrl"; + public const string FirstRewardCtrl = "FirstRewardCtrl"; + public const string SignInViewCtrl = "SignInViewCtrl"; + public const string HallCtrl = "HallCtrl"; + public const string WheelViewCtrl = "WheelViewCtrl"; + public const string PassViewCtrl = "PassViewCtrl"; + public const string H5Ctrl = "H5Ctrl"; + public const string PassunlockCtrl = "PassunlockCtrl"; + public const string PackrewardCtrl = "PackrewardCtrl"; + public const string BuygoldCtrl = "BuygoldCtrl"; + public const string GameMenuCtrl = "GameMenuCtrl"; + public const string MakeupConfirmCtrl = "MakeupConfirmCtrl"; + public const string MakeupRecordCtrl = "MakeupRecordCtrl"; + public const string WebViewCtrl = "WebViewCtrl"; + public const string AdcomingCtrl = "AdcomingCtrl"; + public const string RegulationCtrl = "RegulationCtrl"; + public const string MainTabCtrl = "MainTabCtrl"; + public const string MailViewCtrl = "MailViewCtrl"; + public const string PersonViewCtrl = "PersonViewCtrl"; + public const string GuideViewCtrl = "GuideViewCtrl"; + public const string TipsViewCtrl = "TipsViewCtrl"; + public const string ResurgenceCtrl = "ResurgenceCtrl"; + public const string LuckyPackCtrl = "LuckyPackCtrl"; + public const string RecordViewCtrl = "RecordViewCtrl"; + public const string ThreeDaysGiftCtrl = "ThreeDaysGiftCtrl"; + public const string RewardMulNewCtrl = "RewardMulNewCtrl"; + public const string NewEndCtrl = "NewEndCtrl"; + + public const string UnlockLevelCtrl = "UnlockLevelCtrl"; + public const string AlubumCtrl = "AlubumCtrl"; + public const string AlbumDetailCtrl = "AlbumDetailCtrl"; + public const string LiveCtrl = "LiveCtrl"; + public const string LiveDetailCtrl = "LiveDetailCtrl"; + public const string SecretAlbumsCtrl = "SecretAlbumsCtrl"; + public const string SecretGiftViewCtrl = "SecretGiftViewCtrl"; + public const string SecretUnlockCtrl = "SecretUnlockCtrl"; + public const string SecretAlbumsNextCtrl = "SecretAlbumsNextCtrl"; + public const string SecretDetailCtrl = "SecretDetailCtrl"; + public const string VipClubViewCtrl = "VipClubViewCtrl"; + public const string LiveUnlockCtrl = "LiveUnlockCtrl"; + public const string SubUnlockCtrl = "SubUnlockCtrl"; + public const string ScAlbumLockCtrl = "ScAlbumLockCtrl"; + public const string UnlockTipsCtrl = "UnlockTipsCtrl"; + public const string NetworkErrorTipsCtrl = "NetworkErrorTipsCtrl"; + public const string GoldRewardCtrl = "GoldRewardCtrl"; + public const string ChatChooseCtrl = "ChatChooseCtrl"; + public const string ChatCtrl = "ChatCtrl"; + public const string ChatNumberCtrl = "ChatNumberCtrl"; + public const string ChatUnlockCtrl = "ChatUnlockCtrl"; + public const string UnlockLevelNewCtrl = "UnlockLevelNewCtrl"; + public const string BroadcastCtrl = "BroadcastCtrl"; + public const string EggViewCtrl = "EggViewCtrl"; + public const string ArrowGameCtrl = "ArrowGameCtrl"; + public const string ArrowThemeCtrl = "ArrowThemeCtrl"; + public const string ArrowTipsCtrl = "ArrowTipsCtrl"; + public const string StatementViewCtrl = "StatementViewCtrl"; + public const string PettyAwardCtrl = "PettyAwardCtrl"; + public const string SaveingPotCtrl = "SaveingPotCtrl"; + public const string GameAgainCtrl = "GameAgainCtrl"; + public const string ArrowSettingCtrl = "ArrowSettingCtrl"; + } } \ No newline at end of file diff --git a/Assets/Scripts/ModuleManager/ModelConst.cs b/Assets/Scripts/ModuleManager/ModelConst.cs index efcff301..a0b6c958 100644 --- a/Assets/Scripts/ModuleManager/ModelConst.cs +++ b/Assets/Scripts/ModuleManager/ModelConst.cs @@ -1,78 +1,86 @@ -namespace RedHotRoast -{ - public static class ModelConst - { - public const string LoginModel = "LoginModel"; - public const string RewardAniModel = "RewardAniModel"; - public const string FXWndModel = "FXWndModel"; - public const string GameLoginModel = "GameLoginModel"; - public const string JoastModel = "JoastModel"; - public const string PrivacyModel = "PrivacyModel"; - public const string LoadingModel = "LoadingModel"; - public const string OpenBgModel = "OpenBgModel"; - public const string NetLoadingModel = "NetLoadingModel"; - public const string MenuModel = "MenuModel"; - public const string LanguageViewModel = "LanguageModel"; - public const string RainPlayModel = "RainPlayModel"; - public const string CoinWnd_newModel = "CoinWnd_newModel"; - public const string RewardModel = "RewardModel"; - public const string ChoosePropModel = "ChoosePropModel"; - public const string BuyPropModel = "BuyPropModel"; - public const string GameResultModel = "GameResultModel"; - public const string AddViewModel = "AddViewModel"; - public const string OpenGameModel = "OpenGameModel"; - public const string NewTaskModel = "NewTaskModel"; - public const string GetTaskRewardModel = "GetTaskRewardModel"; - public const string RewardboxModel = "RewardboxModel"; - public const string PayloadingModel = "PayloadingModel"; - public const string FirstRewardModel = "FirstRewardModel"; - public const string HallModel = "HallModel"; - public const string PassViewModel = "PassViewModel"; - public const string SignInViewModel = "SignInViewModel"; - public const string WheelViewModel = "WheelViewModel"; - public const string H5Model = "H5Model"; - public const string PassunlockModel = "PassunlockModel"; - public const string PackrewardModel = "PackrewardModel"; - public const string BuygoldModel = "BuygoldModel"; - public const string GameMenuModel = "GameMenuModel"; - public const string MakeupConfirmModel = "MakeupConfirmModel"; - public const string MakeupRecordModel = "MakeupRecordModel"; - public const string AdcomingModel = "AdcomingModel"; - public const string RegulationModel = "RegulationModel"; - public const string MainTabModel = "MainTabModel"; - public const string MailViewModel = "MailViewModel"; - public const string PersonViewModel = "PersonViewModel"; - public const string GuideViewModel = "GuideViewModel"; - public const string TipsViewModel = "TipsViewModel"; - public const string ResurgenceModel = "ResurgenceModel"; - public const string LuckyPackModel = "LuckyPackModel"; - public const string RecordViewModel = "RecordViewModel"; - public const string ThreeDaysGiftModel = "ThreeDaysGiftModel"; - public const string RewardMulNewModel = "RewardMulNewModel"; - public const string NewEndModel = "NewEndModel"; - public const string UnlockLevelModel = "UnlockLevelModel"; - public const string AlubumModel = "AlubumModel"; - public const string AlbumDetailModel = "AlbumDetailModel"; - public const string SecretAlbumsModel = "SecretAlbumsModel"; - public const string SecretGiftViewModel = "SecretGiftViewModel"; - public const string SecretUnlockModel = "SecretUnlockModel"; - public const string SecretAlbumsNextModel = "SecretAlbumsNextModel"; - public const string SecretDetailModel = "SecretDetailModel"; - public const string LiveModel = "LiveModel"; - public const string LiveDetailModel = "LiveDetailModel"; - public const string VipClubViewModel = "VipClubViewModel"; - public const string LiveUnlockModel = "LiveUnlockModel"; - public const string SubUnlockModel = "SubUnlockModel"; - public const string ScAlbumLockModel = "ScAlbumLockModel"; - public const string UnlockTipsModel = "UnlockTipsModel"; - public const string NetworkErrorTipsModel = "NetworkErrorTipsModel"; - public const string GoldRewardModel = "GoldRewardModel"; - public const string ChatChooseModel = "ChatChooseModel"; - public const string ChatModel = "ChatModel"; - public const string ChatNumberModel = "ChatNumberModel"; - public const string ChatUnlockModel = "ChatUnlockModel"; - public const string UnlockLevelNewModel = "UnlockLevelNewModel"; - public const string BroadcastModel = "BroadcastModel"; - public const string EggViewModel = "EggViewModel"; - } +namespace RedHotRoast +{ + public static class ModelConst + { + public const string LoginModel = "LoginModel"; + public const string RewardAniModel = "RewardAniModel"; + public const string FXWndModel = "FXWndModel"; + public const string GameLoginModel = "GameLoginModel"; + public const string JoastModel = "JoastModel"; + public const string PrivacyModel = "PrivacyModel"; + public const string LoadingModel = "LoadingModel"; + public const string OpenBgModel = "OpenBgModel"; + public const string NetLoadingModel = "NetLoadingModel"; + public const string MenuModel = "MenuModel"; + public const string LanguageViewModel = "LanguageModel"; + public const string RainPlayModel = "RainPlayModel"; + public const string CoinWnd_newModel = "CoinWnd_newModel"; + public const string RewardModel = "RewardModel"; + public const string ChoosePropModel = "ChoosePropModel"; + public const string BuyPropModel = "BuyPropModel"; + public const string GameResultModel = "GameResultModel"; + public const string AddViewModel = "AddViewModel"; + public const string OpenGameModel = "OpenGameModel"; + public const string NewTaskModel = "NewTaskModel"; + public const string GetTaskRewardModel = "GetTaskRewardModel"; + public const string RewardboxModel = "RewardboxModel"; + public const string PayloadingModel = "PayloadingModel"; + public const string FirstRewardModel = "FirstRewardModel"; + public const string HallModel = "HallModel"; + public const string PassViewModel = "PassViewModel"; + public const string SignInViewModel = "SignInViewModel"; + public const string WheelViewModel = "WheelViewModel"; + public const string H5Model = "H5Model"; + public const string PassunlockModel = "PassunlockModel"; + public const string PackrewardModel = "PackrewardModel"; + public const string BuygoldModel = "BuygoldModel"; + public const string GameMenuModel = "GameMenuModel"; + public const string MakeupConfirmModel = "MakeupConfirmModel"; + public const string MakeupRecordModel = "MakeupRecordModel"; + public const string AdcomingModel = "AdcomingModel"; + public const string RegulationModel = "RegulationModel"; + public const string MainTabModel = "MainTabModel"; + public const string MailViewModel = "MailViewModel"; + public const string PersonViewModel = "PersonViewModel"; + public const string GuideViewModel = "GuideViewModel"; + public const string TipsViewModel = "TipsViewModel"; + public const string ResurgenceModel = "ResurgenceModel"; + public const string LuckyPackModel = "LuckyPackModel"; + public const string RecordViewModel = "RecordViewModel"; + public const string ThreeDaysGiftModel = "ThreeDaysGiftModel"; + public const string RewardMulNewModel = "RewardMulNewModel"; + public const string NewEndModel = "NewEndModel"; + public const string UnlockLevelModel = "UnlockLevelModel"; + public const string AlubumModel = "AlubumModel"; + public const string AlbumDetailModel = "AlbumDetailModel"; + public const string SecretAlbumsModel = "SecretAlbumsModel"; + public const string SecretGiftViewModel = "SecretGiftViewModel"; + public const string SecretUnlockModel = "SecretUnlockModel"; + public const string SecretAlbumsNextModel = "SecretAlbumsNextModel"; + public const string SecretDetailModel = "SecretDetailModel"; + public const string LiveModel = "LiveModel"; + public const string LiveDetailModel = "LiveDetailModel"; + public const string VipClubViewModel = "VipClubViewModel"; + public const string LiveUnlockModel = "LiveUnlockModel"; + public const string SubUnlockModel = "SubUnlockModel"; + public const string ScAlbumLockModel = "ScAlbumLockModel"; + public const string UnlockTipsModel = "UnlockTipsModel"; + public const string NetworkErrorTipsModel = "NetworkErrorTipsModel"; + public const string GoldRewardModel = "GoldRewardModel"; + public const string ChatChooseModel = "ChatChooseModel"; + public const string ChatModel = "ChatModel"; + public const string ChatNumberModel = "ChatNumberModel"; + public const string ChatUnlockModel = "ChatUnlockModel"; + public const string UnlockLevelNewModel = "UnlockLevelNewModel"; + public const string BroadcastModel = "BroadcastModel"; + public const string EggViewModel = "EggViewModel"; + public const string ArrowGameModel = "ArrowGameModel"; + public const string ArrowThemeModel = "ArrowThemeModel"; + public const string ArrowTipsModel = "ArrowTipsModel"; + public const string StatementViewModel = "StatementViewModel"; + public const string PettyAwardModel = "PettyAwardModel"; + public const string SaveingPotModel = "SaveingPotModel"; + public const string GameAgainModel = "GameAgainModel"; + public const string ArrowSettingModel = "ArrowSettingModel"; + } } \ No newline at end of file diff --git a/Assets/Scripts/ModuleManager/ModuleManagerRegister.cs b/Assets/Scripts/ModuleManager/ModuleManagerRegister.cs index 2f61b62a..29e333c2 100644 --- a/Assets/Scripts/ModuleManager/ModuleManagerRegister.cs +++ b/Assets/Scripts/ModuleManager/ModuleManagerRegister.cs @@ -34,7 +34,6 @@ namespace RedHotRoast moduleManager.AddModel(ModelConst.PassunlockModel, new PassunlockModel()); moduleManager.AddModel(ModelConst.BuygoldModel, new BuygoldModel()); moduleManager.AddModel(ModelConst.AdcomingModel, new AdcomingModel()); - moduleManager.AddModel(ModelConst.MainTabModel, new MainTabModel()); moduleManager.AddModel(ModelConst.MailViewModel, new MailViewModel()); moduleManager.AddModel(ModelConst.PersonViewModel, new PersonViewModel()); moduleManager.AddModel(ModelConst.GuideViewModel, new GuideViewModel()); @@ -68,6 +67,15 @@ namespace RedHotRoast moduleManager.AddModel(ModelConst.BroadcastModel, new BroadcastModel()); moduleManager.AddModel(ModelConst.EggViewModel, new EggViewModel()); moduleManager.AddModel(ModelConst.H5Model, new H5Model()); + moduleManager.AddModel(ModelConst.ArrowGameModel, new ArrowGameModel()); + moduleManager.AddModel(ModelConst.ArrowThemeModel, new ArrowThemeModel()); + moduleManager.AddModel(ModelConst.ArrowTipsModel, new ArrowTipsModel()); + moduleManager.AddModel(ModelConst.StatementViewModel, new StatementViewModel()); + moduleManager.AddModel(ModelConst.PettyAwardModel, new PettyAwardModel()); + moduleManager.AddModel(ModelConst.SaveingPotModel, new SaveingPotModel()); + moduleManager.AddModel(ModelConst.MakeupConfirmModel, new MakeupConfirmModel()); + moduleManager.AddModel(ModelConst.GameAgainModel, new GameAgainModel()); + moduleManager.AddModel(ModelConst.ArrowSettingModel, new ArrowSettingModel()); } public static void AutoRegisterUICtrl() { @@ -101,7 +109,6 @@ namespace RedHotRoast moduleManager.AddUICtrl(UICtrlConst.PassViewUICtrl, new PassViewUICtrl()); moduleManager.AddUICtrl(UICtrlConst.PassunlockUICtrl, new PassunlockUICtrl()); moduleManager.AddUICtrl(UICtrlConst.BuygoldUICtrl, new BuygoldUICtrl()); - moduleManager.AddUICtrl(UICtrlConst.MainTabUICtrl, new MainTabUICtrl()); moduleManager.AddUICtrl(UICtrlConst.MailViewUICtrl, new MailViewUICtrl()); moduleManager.AddUICtrl(UICtrlConst.PersonViewUICtrl, new PersonViewUICtrl()); moduleManager.AddUICtrl(UICtrlConst.GuideViewUICtrl, new GuideViewUICtrl()); @@ -136,6 +143,15 @@ namespace RedHotRoast moduleManager.AddUICtrl(UICtrlConst.BroadcastUICtrl, new BroadcastUICtrl()); moduleManager.AddUICtrl(UICtrlConst.EggViewUICtrl, new EggViewUICtrl()); moduleManager.AddUICtrl(UICtrlConst.H5UICtrl, new H5UICtrl()); + moduleManager.AddUICtrl(UICtrlConst.ArrowGameUICtrl, new ArrowGameUICtrl()); + moduleManager.AddUICtrl(UICtrlConst.ArrowThemeUICtrl, new ArrowThemeUICtrl()); + moduleManager.AddUICtrl(UICtrlConst.ArrowTipsUICtrl, new ArrowTipsUICtrl()); + moduleManager.AddUICtrl(UICtrlConst.StatementViewUICtrl, new StatementViewUICtrl()); + moduleManager.AddUICtrl(UICtrlConst.PettyAwardUICtrl, new PettyAwardUICtrl()); + moduleManager.AddUICtrl(UICtrlConst.SaveingPotUICtrl, new SaveingPotUICtrl()); + moduleManager.AddUICtrl(UICtrlConst.MakeupConfirmUICtrl, new MakeupConfirmUICtrl()); + moduleManager.AddUICtrl(UICtrlConst.GameAgainUICtrl, new GameAgainUICtrl()); + moduleManager.AddUICtrl(UICtrlConst.ArrowSettingUICtrl, new ArrowSettingUICtrl()); } public static void AutoRegisterCtrl() @@ -171,7 +187,6 @@ namespace RedHotRoast moduleManager.AddCtrl(CtrlConst.PassViewCtrl, new PassViewCtrl()); moduleManager.AddCtrl(CtrlConst.PassunlockCtrl, new PassunlockCtrl()); moduleManager.AddCtrl(CtrlConst.BuygoldCtrl, new BuygoldCtrl()); - moduleManager.AddCtrl(CtrlConst.MainTabCtrl, new MainTabCtrl()); moduleManager.AddCtrl(CtrlConst.MailViewCtrl, new MailViewCtrl()); moduleManager.AddCtrl(CtrlConst.PersonViewCtrl, new PersonViewCtrl()); moduleManager.AddCtrl(CtrlConst.GuideViewCtrl, new GuideViewCtrl()); @@ -211,6 +226,15 @@ namespace RedHotRoast moduleManager.AddCtrl(CtrlConst.BroadcastCtrl, new BroadcastCtrl()); moduleManager.AddCtrl(CtrlConst.EggViewCtrl, new EggViewCtrl()); moduleManager.AddCtrl(CtrlConst.H5Ctrl, new H5Ctrl()); + moduleManager.AddCtrl(CtrlConst.ArrowGameCtrl, new ArrowGameCtrl()); + moduleManager.AddCtrl(CtrlConst.ArrowThemeCtrl, new ArrowThemeCtrl()); + moduleManager.AddCtrl(CtrlConst.ArrowTipsCtrl, new ArrowTipsCtrl()); + moduleManager.AddCtrl(CtrlConst.StatementViewCtrl, new StatementViewCtrl()); + moduleManager.AddCtrl(CtrlConst.PettyAwardCtrl, new PettyAwardCtrl()); + moduleManager.AddCtrl(CtrlConst.SaveingPotCtrl, new SaveingPotCtrl()); + moduleManager.AddCtrl(CtrlConst.MakeupConfirmCtrl, new MakeupConfirmCtrl()); + moduleManager.AddCtrl(CtrlConst.GameAgainCtrl, new GameAgainCtrl()); + moduleManager.AddCtrl(CtrlConst.ArrowSettingCtrl, new ArrowSettingCtrl()); } public static void AutoRegisterUIType() @@ -246,7 +270,6 @@ namespace RedHotRoast moduleManager.AddUIType(UIConst.PassViewUI, typeof(PassViewUI)); moduleManager.AddUIType(UIConst.PassunlockUI, typeof(PassunlockUI)); moduleManager.AddUIType(UIConst.BuygoldUI, typeof(BuygoldUI)); - moduleManager.AddUIType(UIConst.MainTabUI, typeof(MainTabUI)); moduleManager.AddUIType(UIConst.MailViewUI, typeof(MailViewUI)); moduleManager.AddUIType(UIConst.PersonViewUI, typeof(PersonViewUI)); moduleManager.AddUIType(UIConst.GuideViewUI, typeof(GuideViewUI)); @@ -283,6 +306,16 @@ namespace RedHotRoast moduleManager.AddUIType(UIConst.BroadcastUI, typeof(BroadcastUI)); moduleManager.AddUIType(UIConst.EggViewUI, typeof(EggViewUI)); moduleManager.AddUIType(UIConst.H5UI, typeof(H5UI)); + moduleManager.AddUIType(UIConst.ArrowGameUI, typeof(ArrowGameUI)); + moduleManager.AddUIType(UIConst.ArrowThemeUI, typeof(ArrowThemeUI)); + moduleManager.AddUIType(UIConst.ArrowTipsUI, typeof(ArrowTipsUI)); + moduleManager.AddUIType(UIConst.StatementViewUI, typeof(StatementViewUI)); + moduleManager.AddUIType(UIConst.PettyAwardUI, typeof(PettyAwardUI)); + moduleManager.AddUIType(UIConst.SaveingPotUI, typeof(SaveingPotUI)); + moduleManager.AddUIType(UIConst.MakeupConfirmUI, typeof(MakeupConfirmUI)); + moduleManager.AddUIType(UIConst.GameAgainUI, typeof(GameAgainUI)); + moduleManager.AddUIType(UIConst.ArrowSettingUI, typeof(ArrowSettingUI)); + } } } \ No newline at end of file diff --git a/Assets/Scripts/ModuleManager/UIConst.cs b/Assets/Scripts/ModuleManager/UIConst.cs index 775617fa..20a0cdf7 100644 --- a/Assets/Scripts/ModuleManager/UIConst.cs +++ b/Assets/Scripts/ModuleManager/UIConst.cs @@ -1,77 +1,87 @@ -namespace RedHotRoast -{ - public static class UIConst - { - public const string GameLoginUI = "GameLoginUI"; - public const string RewardAniUI = "RewardAniUI"; - public const string JoastUI = "JoastUI"; - public const string MenuUI = "MenuUI"; - public const string LanguageViewUI = "LanguageViewUI"; - public const string LoadingUI = "LoadingUI"; - public const string NetLoadingUI = "NetLoadingUI"; - public const string CoinWnd_newUI = "CoinWnd_newUI"; - public const string FXWndUI = "FXWndUI"; - public const string OpenBgUI = "OpenBgUI"; - public const string PrivacyUI = "PrivacyUI"; - public const string RewardUI = "RewardUI"; - public const string ChoosePropUI = "ChoosePropUI"; - public const string H5UI = "H5UI"; - public const string RainPlayUI = "RainPlayUI"; - public const string GameResultUI = "GameResultUI"; - public const string AddViewUI = "AddViewUI"; - public const string BuyPropUI = "BuyPropUI"; - public const string OpenGameUI = "OpenGameUI"; - public const string NewTaskUI = "NewTaskUI"; - public const string GetTaskRewardUI = "GetTaskRewardUI"; - public const string RewardboxUI = "RewardboxUI"; - public const string PayloadingUI = "PayloadingUI"; - public const string FirstRewardUI = "FirstRewardUI"; - public const string HallUI = "HallUI"; - public const string SignInViewUI = "SignInViewUI"; - public const string WheelViewUI = "WheelViewUI"; - public const string PassViewUI = "PassViewUI"; - public const string PassunlockUI = "PassunlockUI"; - public const string PackrewardUI = "PackrewardUI"; - public const string BuygoldUI = "BuygoldUI"; - public const string GameMenuUI = "GameMenuUI"; - public const string MakeupConfirmUI = "MakeupConfirmUI"; - public const string MakeupRecordUI = "MakeupRecordUI"; - public const string AdcomingUI = "AdcomingUI"; - public const string RegulationUI = "RegulationUI"; - public const string MainTabUI = "MainTabUI"; - public const string MailViewUI = "MailViewUI"; - public const string PersonViewUI = "PersonViewUI"; - public const string GuideViewUI = "GuideViewUI"; - public const string TipsViewUI = "TipsViewUI"; - public const string ResurgenceUI = "ResurgenceUI"; - public const string LuckyPackUI = "LuckyPackUI"; - public const string RecordViewUI = "RecordViewUI"; - public const string ThreeDaysGiftUI = "ThreeDaysGiftUI"; - public const string RewardMulNewUI = "RewardMulNewUI"; - public const string NewEndUI = "NewEndUI"; - public const string UnlockLevelUI = "UnlockLevelUI"; - public const string AlubumUI = "AlubumUI"; - public const string AlbumDetailUI = "AlbumDetailUI"; - public const string LiveUI = "LiveUI"; - public const string LiveDetailUI = "LiveDetailUI"; - public const string SecretAlbumsUI = "SecretAlbumsUI"; - public const string SecretGiftViewUI = "SecretGiftViewUI"; - public const string SecretUnlockUI = "SecretUnlockUI"; - public const string SecretAlbumsNextUI = "SecretAlbumsNextUI"; - public const string SecretDetailUI = "SecretDetailUI"; - public const string VipClubViewUI = "VipClubViewUI"; - public const string LiveUnlockUI = "LiveUnlockUI"; - public const string SubUnlockUI = "SubUnlockUI"; - public const string ScAlbumLockUI = "ScAlbumLockUI"; - public const string UnlockTipsUI = "UnlockTipsUI"; - public const string NetworkErrorTipsUI = "NetworkErrorTipsUI"; - public const string GoldRewardUI = "GoldRewardUI"; - public const string ChatChooseUI = "ChatChooseUI"; - public const string ChatUI = "ChatUI"; - public const string ChatNumberUI = "ChatNumberUI"; - public const string ChatUnlockUI = "ChatUnlockUI"; - public const string UnlockLevelNewUI = "UnlockLevelNewUI"; - public const string BroadcastUI = "BroadcastUI"; - public const string EggViewUI = "EggViewUI"; - } +namespace RedHotRoast +{ + public static class UIConst + { + public const string GameLoginUI = "GameLoginUI"; + public const string RewardAniUI = "RewardAniUI"; + public const string JoastUI = "JoastUI"; + public const string MenuUI = "MenuUI"; + public const string LanguageViewUI = "LanguageViewUI"; + public const string LoadingUI = "LoadingUI"; + public const string NetLoadingUI = "NetLoadingUI"; + public const string CoinWnd_newUI = "CoinWnd_newUI"; + public const string FXWndUI = "FXWndUI"; + public const string OpenBgUI = "OpenBgUI"; + public const string PrivacyUI = "PrivacyUI"; + public const string RewardUI = "RewardUI"; + public const string ChoosePropUI = "ChoosePropUI"; + public const string H5UI = "H5UI"; + public const string RainPlayUI = "RainPlayUI"; + public const string GameResultUI = "GameResultUI"; + public const string AddViewUI = "AddViewUI"; + public const string BuyPropUI = "BuyPropUI"; + public const string OpenGameUI = "OpenGameUI"; + public const string NewTaskUI = "NewTaskUI"; + public const string GetTaskRewardUI = "GetTaskRewardUI"; + public const string RewardboxUI = "RewardboxUI"; + public const string PayloadingUI = "PayloadingUI"; + public const string FirstRewardUI = "FirstRewardUI"; + public const string HallUI = "HallUI"; + public const string SignInViewUI = "SignInViewUI"; + public const string WheelViewUI = "WheelViewUI"; + public const string PassViewUI = "PassViewUI"; + public const string PassunlockUI = "PassunlockUI"; + public const string PackrewardUI = "PackrewardUI"; + public const string BuygoldUI = "BuygoldUI"; + public const string GameMenuUI = "GameMenuUI"; + public const string MakeupConfirmUI = "MakeupConfirmUI"; + public const string MakeupRecordUI = "MakeupRecordUI"; + public const string AdcomingUI = "AdcomingUI"; + public const string RegulationUI = "RegulationUI"; + public const string MainTabUI = "MainTabUI"; + public const string MailViewUI = "MailViewUI"; + public const string PersonViewUI = "PersonViewUI"; + public const string GuideViewUI = "GuideViewUI"; + public const string TipsViewUI = "TipsViewUI"; + public const string ResurgenceUI = "ResurgenceUI"; + public const string LuckyPackUI = "LuckyPackUI"; + public const string RecordViewUI = "RecordViewUI"; + public const string ThreeDaysGiftUI = "ThreeDaysGiftUI"; + public const string RewardMulNewUI = "RewardMulNewUI"; + public const string NewEndUI = "NewEndUI"; + public const string UnlockLevelUI = "UnlockLevelUI"; + public const string AlubumUI = "AlubumUI"; + public const string AlbumDetailUI = "AlbumDetailUI"; + public const string LiveUI = "LiveUI"; + public const string LiveDetailUI = "LiveDetailUI"; + public const string SecretAlbumsUI = "SecretAlbumsUI"; + public const string SecretGiftViewUI = "SecretGiftViewUI"; + public const string SecretUnlockUI = "SecretUnlockUI"; + public const string SecretAlbumsNextUI = "SecretAlbumsNextUI"; + public const string SecretDetailUI = "SecretDetailUI"; + public const string VipClubViewUI = "VipClubViewUI"; + public const string LiveUnlockUI = "LiveUnlockUI"; + public const string SubUnlockUI = "SubUnlockUI"; + public const string ScAlbumLockUI = "ScAlbumLockUI"; + public const string UnlockTipsUI = "UnlockTipsUI"; + public const string NetworkErrorTipsUI = "NetworkErrorTipsUI"; + public const string GoldRewardUI = "GoldRewardUI"; + public const string ChatChooseUI = "ChatChooseUI"; + public const string ChatUI = "ChatUI"; + public const string ChatNumberUI = "ChatNumberUI"; + public const string ChatUnlockUI = "ChatUnlockUI"; + public const string UnlockLevelNewUI = "UnlockLevelNewUI"; + public const string BroadcastUI = "BroadcastUI"; + public const string EggViewUI = "EggViewUI"; + public const string ArrowGameUI = "ArrowGameUI"; + public const string ArrowThemeUI = "ArrowThemeUI"; + public const string ArrowTipsUI = "ArrowTipsUI"; + public const string StatementViewUI = "StatementViewUI"; + public const string PettyAwardUI = "PettyAwardUI"; + public const string SaveingPotUI = "SaveingPotUI"; + public const string GameAgainUI = "GameAgainUI"; + public const string ArrowSettingUI = "ArrowSettingUI"; + + + } } \ No newline at end of file diff --git a/Assets/Scripts/ModuleManager/UICtrlConst.cs b/Assets/Scripts/ModuleManager/UICtrlConst.cs index 0610086c..723a8a0a 100644 --- a/Assets/Scripts/ModuleManager/UICtrlConst.cs +++ b/Assets/Scripts/ModuleManager/UICtrlConst.cs @@ -1,78 +1,86 @@ -namespace RedHotRoast -{ - public static class UICtrlConst - { - public const string JoastUICtrl = "JoastUICtrl"; - public const string LoadingUICtrl = "LoadingUICtrl"; - public const string RewardAniUICtrl = "RewardAniUICtrl"; - public const string FXWndUICtrl = "FXWndUICtrl"; - public const string BuyPropUICtrl = "BuyPropUICtrl"; - public const string GameResultUICtrl = "GameResultUICtrl"; - public const string MenuUICtrl = "MenuUICtrl"; - public const string LanguageViewUICtrl = "LanguageViewUICtrl"; - public const string NetLoadingUICtrl = "NetLoadingUICtrl"; - public const string GameLoginUICtrl = "GameLoginUICtrl"; - public const string RewardUICtrl = "RewardUICtrl"; - public const string CoinWnd_newUICtrl = "CoinWnd_newUICtrl"; - public const string RainPlayUICtrl = "RainPlayUICtrl"; - public const string ChoosePropUICtrl = "ChoosePropUICtrl"; - public const string OpenBgUICtrl = "OpenBgUICtrl"; - public const string PrivacyUICtrl = "PrivacyUICtrl"; - public const string AddViewUICtrl = "AddViewUICtrl"; - public const string OpenGameUICtrl = "OpenGameUICtrl"; - public const string NewTaskUICtrl = "NewTaskUICtrl"; - public const string GetTaskRewardUICtrl = "GetTaskRewardUICtrl"; - public const string RewardboxUICtrl = "RewardboxUICtrl"; - public const string PayloadingUICtrl = "PayloadingUICtrl"; - public const string FirstRewardUICtrl = "FirstRewardUICtrl"; - public const string HallUICtrl = "HallUICtrl"; - public const string SignInViewUICtrl = "SignInViewUICtrl"; - public const string WheelViewUICtrl = "WheelViewUICtrl"; - public const string PassViewUICtrl = "PassViewUICtrl"; - public const string H5UICtrl = "H5UICtrl"; - public const string PassunlockUICtrl = "PassunlockUICtrl"; - public const string PackrewardUICtrl = "PackrewardUICtrl"; - public const string BuygoldUICtrl = "BuygoldUICtrl"; - public const string GameMenuUICtrl = "GameMenuUICtrl"; - public const string MakeupConfirmUICtrl = "MakeupConfirmUICtrl"; - public const string MakeupRecordUICtrl = "MakeupRecordUICtrl"; - public const string AdcomingUICtrl = "AdcomingUICtrl"; - public const string RegulationUICtrl = "RegulationUICtrl"; - public const string MainTabUICtrl = "MainTabUICtrl"; - public const string MailViewUICtrl = "MailViewUICtrl"; - public const string PersonViewUICtrl = "PersonViewUICtrl"; - public const string GuideViewUICtrl = "GuideViewUICtrl"; - public const string TipsViewUICtrl = "TipsViewUICtrl"; - public const string ResurgenceUICtrl = "ResurgenceUICtrl"; - public const string LuckyPackUICtrl = "LuckyPackUICtrl"; - public const string RecordViewUICtrl = "RecordViewUICtrl"; - public const string ThreeDaysGiftUICtrl = "ThreeDaysGiftUICtrl"; - public const string RewardMulNewUICtrl = "RewardMulNewUICtrl"; - public const string NewEndUICtrl = "NewEndUICtrl"; - - public const string UnlockLevelUICtrl = "UnlockLevelUICtrl"; - public const string AlubumUICtrl = "AlubumUICtrl"; - public const string AlbumDetailUICtrl = "AlbumDetailUICtrl"; - public const string SecretAlbumsUICtrl = "SecretAlbumsUICtrl"; - public const string SecretGiftViewUICtrl = "SecretGiftViewUICtrl"; - public const string SecretUnlockUICtrl = "SecretUnlockUICtrl"; - public const string SecretAlbumsNextUICtrl = "SecretAlbumsNextUICtrl"; - public const string SecretDetailUICtrl = "SecretDetailUICtrl"; - public const string LiveUICtrl = "LiveUICtrl"; - public const string LiveDetailUICtrl = "LiveDetailUICtrl"; - public const string VipClubViewUICtrl = "VipClubViewUICtrl"; - public const string LiveUnlockUICtrl = "LiveUnlockUICtrl"; - public const string SubUnlockUICtrl = "SubUnlockUICtrl"; - public const string ScAlbumLockUICtrl = "ScAlbumLockUICtrl"; - public const string UnlockTipsUICtrl = "UnlockTipsUICtrl"; - public const string NetworkErrorTipsUICtrl = "NetworkErrorTipsUICtrl"; - public const string GoldRewardUICtrl = "GoldRewardUICtrl"; - public const string ChatChooseUICtrl = "ChatChooseUICtrl"; - public const string ChatUICtrl = "ChatUICtrl"; - public const string ChatNumberUICtrl = "ChatNumberUICtrl"; - public const string ChatUnlockUICtrl = "ChatUnlockUICtrl"; - public const string UnlockLevelNewUICtrl = "UnlockLevelNewUICtrl"; - public const string BroadcastUICtrl = "BroadcastUICtrl"; - public const string EggViewUICtrl = "EggViewUICtrl"; - } +namespace RedHotRoast +{ + public static class UICtrlConst + { + public const string JoastUICtrl = "JoastUICtrl"; + public const string LoadingUICtrl = "LoadingUICtrl"; + public const string RewardAniUICtrl = "RewardAniUICtrl"; + public const string FXWndUICtrl = "FXWndUICtrl"; + public const string BuyPropUICtrl = "BuyPropUICtrl"; + public const string GameResultUICtrl = "GameResultUICtrl"; + public const string MenuUICtrl = "MenuUICtrl"; + public const string LanguageViewUICtrl = "LanguageViewUICtrl"; + public const string NetLoadingUICtrl = "NetLoadingUICtrl"; + public const string GameLoginUICtrl = "GameLoginUICtrl"; + public const string RewardUICtrl = "RewardUICtrl"; + public const string CoinWnd_newUICtrl = "CoinWnd_newUICtrl"; + public const string RainPlayUICtrl = "RainPlayUICtrl"; + public const string ChoosePropUICtrl = "ChoosePropUICtrl"; + public const string OpenBgUICtrl = "OpenBgUICtrl"; + public const string PrivacyUICtrl = "PrivacyUICtrl"; + public const string AddViewUICtrl = "AddViewUICtrl"; + public const string OpenGameUICtrl = "OpenGameUICtrl"; + public const string NewTaskUICtrl = "NewTaskUICtrl"; + public const string GetTaskRewardUICtrl = "GetTaskRewardUICtrl"; + public const string RewardboxUICtrl = "RewardboxUICtrl"; + public const string PayloadingUICtrl = "PayloadingUICtrl"; + public const string FirstRewardUICtrl = "FirstRewardUICtrl"; + public const string HallUICtrl = "HallUICtrl"; + public const string SignInViewUICtrl = "SignInViewUICtrl"; + public const string WheelViewUICtrl = "WheelViewUICtrl"; + public const string PassViewUICtrl = "PassViewUICtrl"; + public const string H5UICtrl = "H5UICtrl"; + public const string PassunlockUICtrl = "PassunlockUICtrl"; + public const string PackrewardUICtrl = "PackrewardUICtrl"; + public const string BuygoldUICtrl = "BuygoldUICtrl"; + public const string GameMenuUICtrl = "GameMenuUICtrl"; + public const string MakeupConfirmUICtrl = "MakeupConfirmUICtrl"; + public const string MakeupRecordUICtrl = "MakeupRecordUICtrl"; + public const string AdcomingUICtrl = "AdcomingUICtrl"; + public const string RegulationUICtrl = "RegulationUICtrl"; + public const string MainTabUICtrl = "MainTabUICtrl"; + public const string MailViewUICtrl = "MailViewUICtrl"; + public const string PersonViewUICtrl = "PersonViewUICtrl"; + public const string GuideViewUICtrl = "GuideViewUICtrl"; + public const string TipsViewUICtrl = "TipsViewUICtrl"; + public const string ResurgenceUICtrl = "ResurgenceUICtrl"; + public const string LuckyPackUICtrl = "LuckyPackUICtrl"; + public const string RecordViewUICtrl = "RecordViewUICtrl"; + public const string ThreeDaysGiftUICtrl = "ThreeDaysGiftUICtrl"; + public const string RewardMulNewUICtrl = "RewardMulNewUICtrl"; + public const string NewEndUICtrl = "NewEndUICtrl"; + + public const string UnlockLevelUICtrl = "UnlockLevelUICtrl"; + public const string AlubumUICtrl = "AlubumUICtrl"; + public const string AlbumDetailUICtrl = "AlbumDetailUICtrl"; + public const string SecretAlbumsUICtrl = "SecretAlbumsUICtrl"; + public const string SecretGiftViewUICtrl = "SecretGiftViewUICtrl"; + public const string SecretUnlockUICtrl = "SecretUnlockUICtrl"; + public const string SecretAlbumsNextUICtrl = "SecretAlbumsNextUICtrl"; + public const string SecretDetailUICtrl = "SecretDetailUICtrl"; + public const string LiveUICtrl = "LiveUICtrl"; + public const string LiveDetailUICtrl = "LiveDetailUICtrl"; + public const string VipClubViewUICtrl = "VipClubViewUICtrl"; + public const string LiveUnlockUICtrl = "LiveUnlockUICtrl"; + public const string SubUnlockUICtrl = "SubUnlockUICtrl"; + public const string ScAlbumLockUICtrl = "ScAlbumLockUICtrl"; + public const string UnlockTipsUICtrl = "UnlockTipsUICtrl"; + public const string NetworkErrorTipsUICtrl = "NetworkErrorTipsUICtrl"; + public const string GoldRewardUICtrl = "GoldRewardUICtrl"; + public const string ChatChooseUICtrl = "ChatChooseUICtrl"; + public const string ChatUICtrl = "ChatUICtrl"; + public const string ChatNumberUICtrl = "ChatNumberUICtrl"; + public const string ChatUnlockUICtrl = "ChatUnlockUICtrl"; + public const string UnlockLevelNewUICtrl = "UnlockLevelNewUICtrl"; + public const string BroadcastUICtrl = "BroadcastUICtrl"; + public const string EggViewUICtrl = "EggViewUICtrl"; + public const string ArrowGameUICtrl = "ArrowGameUICtrl"; + public const string ArrowThemeUICtrl = "ArrowThemeUICtrl"; + public const string ArrowTipsUICtrl = "ArrowTipsUICtrl"; + public const string StatementViewUICtrl = "StatementViewUICtrl"; + public const string PettyAwardUICtrl = "PettyAwardUICtrl"; + public const string SaveingPotUICtrl = "SaveingPotUICtrl"; + public const string GameAgainUICtrl = "GameAgainUICtrl"; + public const string ArrowSettingUICtrl = "ArrowSettingUICtrl"; + } } \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/AddView/AddViewUI.cs b/Assets/Scripts/ModuleUI/AddView/AddViewUI.cs index d19f0bc1..a8a570f5 100644 --- a/Assets/Scripts/ModuleUI/AddView/AddViewUI.cs +++ b/Assets/Scripts/ModuleUI/AddView/AddViewUI.cs @@ -55,7 +55,7 @@ namespace RedHotRoast { TrackKit.SendEvent(GameHelper.GetEventName(), ADEventTrack.Property.buy_one_show); if (args != null) need_call = (bool)args; - // ad_cool_down = ConfigSystem.GetConfig().exchangeCD; + // ad_cool_down = ConfigSystem.GetCommonConf().exchangeCD; // btn_WatchAd = ui.btn_watch as btn_watchAd; if (GameHelper.IsAdModelOfPay()) { diff --git a/Assets/Scripts/ModuleUI/ArrowGame.meta b/Assets/Scripts/ModuleUI/ArrowGame.meta new file mode 100644 index 00000000..317926c1 --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowGame.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4ad5fece43d34a4abe58ce53bcb2aacc +timeCreated: 1783663847 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/MainTab/MainTabCtrl.cs b/Assets/Scripts/ModuleUI/ArrowGame/ArrowGameCtrl.cs similarity index 60% rename from Assets/Scripts/ModuleUI/MainTab/MainTabCtrl.cs rename to Assets/Scripts/ModuleUI/ArrowGame/ArrowGameCtrl.cs index ba33fe61..173acd84 100644 --- a/Assets/Scripts/ModuleUI/MainTab/MainTabCtrl.cs +++ b/Assets/Scripts/ModuleUI/ArrowGame/ArrowGameCtrl.cs @@ -1,10 +1,10 @@ namespace RedHotRoast { - public class MainTabCtrl : BaseCtrl + public class ArrowGameCtrl : BaseCtrl { - public static MainTabCtrl Instance { get; private set; } + public static ArrowGameCtrl Instance { get; private set; } - private MainTabModel model; + private ArrowGameModel model; protected override void OnInit() { diff --git a/Assets/Scripts/ModuleUI/ArrowGame/ArrowGameCtrl.cs.meta b/Assets/Scripts/ModuleUI/ArrowGame/ArrowGameCtrl.cs.meta new file mode 100644 index 00000000..8f945341 --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowGame/ArrowGameCtrl.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0dfe8f46fa1e414b944056bbe769fa67 +timeCreated: 1781178068 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/ArrowGame/ArrowGameModel.cs b/Assets/Scripts/ModuleUI/ArrowGame/ArrowGameModel.cs new file mode 100644 index 00000000..3bbabefc --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowGame/ArrowGameModel.cs @@ -0,0 +1,13 @@ +namespace RedHotRoast +{ + public class ArrowGameModel : BaseModel + { + protected override void OnInit() + { + } + + protected override void OnDispose() + { + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/ArrowGame/ArrowGameModel.cs.meta b/Assets/Scripts/ModuleUI/ArrowGame/ArrowGameModel.cs.meta new file mode 100644 index 00000000..6d74b9da --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowGame/ArrowGameModel.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e6e908da0a114c6aab92325f6c42619d +timeCreated: 1781178068 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/ArrowGame/ArrowGameUI.cs b/Assets/Scripts/ModuleUI/ArrowGame/ArrowGameUI.cs new file mode 100644 index 00000000..051ebbed --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowGame/ArrowGameUI.cs @@ -0,0 +1,2228 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using DG.Tweening; +using FairyGUI; +using FGUI.Arrow_game; +using FGUI.ZM_Common_01; +using UnityEngine; +using Random = UnityEngine.Random; + +namespace RedHotRoast +{ + public class ArrowGameUI : BaseUI + { + private ArrowGameUICtrl ctrl; + private com_arrow_game ui; + + // FGUI界面根容器 + private GComponent _viewContainer; + + // 关卡总配置数据 + private LevelConfig _levelConfig; + + // 网格基础参数 + private int gridColNum = 10; + private int gridRowNum = 10; + private readonly float pointSpace = 60f; + private readonly float outOffset = 200f; + + // 网格边界 + private Vector2 _gridWorldCenter; // 网格世界中心点 + + private float gridLeft; + private float gridRight; + private float gridTop; + private float gridBottom; + + // 网格行列、单个格子尺寸(你原有网格参数) + private int _gridRow; + private int _gridCol; + private float _cellSize; + + // 网格占用标记:true=该点位被占用,false=空闲 + private bool[,] _gridOccupied; + // 记录每个箭头占用的所有网格点位(行,列) + private Dictionary> _arrowOccupiedCells = new Dictionary>(); + + // 爱心数量 + private int _heartCount = 3; + // 记录已经发生过碰撞的箭头对象(去重:同个箭头多次碰撞只扣一次血) + private HashSet _collidedArrows = new HashSet(); + // 统计场上还存在的箭头总数(用于判断全部移除=通关) + private int _remainArrowCount = 0; + + // 记录当前UI所有由 CrazyAsyKit 启动的协程,用于统一停止 + private List _activeCoroutines = new List(); + + // 是否开启删除道具模式 + private bool _isDeleteMode = false; + + // 手指提示图标 + private com_finger _fingerTipObj; + // 当前正在提示的箭头 + private ArrowConfig _currentTipArrow; + // 手指图标偏移(微调位置) + private readonly Vector2 _fingerOffset = new Vector2(-20, -20); + // 所有网格圆点实例列表,用于批量改色/清理 + private List _gridDotList = new List(); + + #region 箭头颜色配置 + // 8种预设彩色,可按需调整色值 + private readonly Color[] _colorfulPalette = new Color[] + { + new Color(1f, 0.3f, 0.3f), // 红 + new Color(1f, 0.6f, 0.2f), // 橙 + new Color(1f, 0.9f, 0.2f), // 黄 + new Color(0.3f, 0.8f, 0.4f), // 绿 + new Color(0.2f, 0.8f, 0.9f), // 青 + new Color(0.3f, 0.5f, 1f), // 蓝 + new Color(0.7f, 0.4f, 1f), // 紫 + new Color(1f, 0.5f, 0.8f) // 粉 + }; + #endregion + + #region 缩放、拖拽、滑动条 全局变量 + // 缩放阈值(滑动条左右边界对应这两个值) + private readonly float _minScale = 0.5f; + private readonly float _maxScale = 1.5f; + // FGUI 滑动条组件 + private GSlider _zoomSlider; + // 双指缩放手势 + private float _lastTwoFingerDistance; + private bool _isTwoFingerTouch; + // 单指拖拽平移 + private Vector2 _lastTouchPos; + private bool _isDraging; + // 拖拽边界留边(防止完全移出屏幕) + private readonly float _dragBorder = -300f; + #endregion + + + public ArrowGameUI(ArrowGameUICtrl ctrl) : base(ctrl) + { + uiName = UIConst.ArrowGameUI; + this.ctrl = ctrl; + } + + protected override void SetUIInfo(UIInfo uiInfo) + { + uiInfo.packageName = "Arrow_game"; + uiInfo.assetName = "com_arrow_game"; + uiInfo.layerType = UILayerType.Bottom; + uiInfo.isNeedOpenAnim = false; + uiInfo.isNeedCloseAnim = false; + uiInfo.isNeedUIMask = true; + uiInfo.isTickUpdate = true; + } + + #region 生命周期 + protected override void OnInit() + { + } + + protected override void OnClose() + { + // ========= 第一步:统一停止所有协程(核心修复) ========= + foreach (var co in _activeCoroutines) + { + if (co != null) + { + CrazyAsyKit.StopCoroutine(co); + } + } + // 清空列表 + _activeCoroutines.Clear(); + + // 保险========= 强制停止所有移动,终止对应协程 ========= + if (_levelConfig != null) + { + foreach (var arrow in _levelConfig.arrows) + { + arrow.isMoving = false; + } + } + + // 销毁所有动态FGUI对象 + ClearAllDynamicObj(); + + HideFingerTip(); + + _levelConfig = null; + + // 清空网格占用数据 + _gridOccupied = null; + _arrowOccupiedCells.Clear(); + + } + + protected override void OnBind() + { + ui = baseUI as com_arrow_game; + } + + // 新增坐标转换方法 + private Vector2 UnityMouseToFGUIPos(Vector2 unityPos) + { + float x = unityPos.x; + float y = Screen.height - unityPos.y; + return new Vector2(x, y); + } + + #region 全局计数式开关 + // 全局开关(true: 恢复输入 false:禁用输入) + private void OpenOrStopGameInput(object obj = null) + { + if (obj != null && !(bool)obj) + { + // 禁用输入 + DisableGameInput(); + } + else + { + // 恢复输入 + EnableGameInput(); + } + } + + private int _inputDisableCount = 0; + // 禁用输入 + private void DisableGameInput() + { + _inputDisableCount++; + // 只有第一次禁用时执行清理 + if (_inputDisableCount == 1) + { + if (_viewContainer != null) + _viewContainer.touchable = false; + + _isDraging = false; + _isTwoFingerTouch = false; + _lastTouchPos = Vector2.zero; + } + } + + // 恢复输入 + private void EnableGameInput(object obj = null) + { + _inputDisableCount = Mathf.Max(0, _inputDisableCount - 1); + // 计数归0时才真正恢复 + if (_inputDisableCount == 0) + { + if (_viewContainer != null) + _viewContainer.touchable = true; + } + } + + #endregion + + public override void OnUpdate() + { + // 禁用输入时,直接跳过拖拽 + if (_inputDisableCount > 0) + { + // Debug.Log($"输入已禁用,直接跳过拖拽"); + return; + } + + // 初始化未完成,直接跳过拖拽 + if (!_initComplete) + return; + +#if UNITY_EDITOR + float moveThreshold = 1f; + + // 鼠标按下:仅在拖拽区域内按下才开启拖拽 + if (InputHelper.Instance.GetMouseButtonDown(0)) + { + Vector2 unityPos = InputHelper.Instance.MousePosition; + Vector2 fguiPos = UnityMouseToFGUIPos(unityPos); + + if (IsInDragArea(fguiPos)) + { + _lastTouchPos = fguiPos; + _isDraging = true; + // Debug.Log("鼠标按下,在拖拽区域内,开始拖拽"); + } + return; + } + + // 拖拽中:原有逻辑不变 + if (_isDraging && InputHelper.Instance.GetMouseButton(0)) + { + Vector2 unityPos = InputHelper.Instance.MousePosition; + Vector2 curMousePos = UnityMouseToFGUIPos(unityPos); + Vector2 offset = curMousePos - _lastTouchPos; + + if (offset.magnitude > moveThreshold) + { + MoveContainer(offset); + _lastTouchPos = curMousePos; + } + } + + // 鼠标抬起,结束拖拽 + if (InputHelper.Instance.GetMouseButtonUp(0)) + { + _isDraging = false; + // Debug.Log("鼠标抬起,结束拖拽"); + } +#endif + + // ========= 双指 = 缩放(优先级最高) ========= + if (InputHelper.Instance.TouchCount == 2) + { + _isDraging = false; + Touch t0 = InputHelper.Instance.GetTouch(0); + Touch t1 = InputHelper.Instance.GetTouch(1); + float currentDis = Vector2.Distance(t0.position, t1.position); + + if (!_isTwoFingerTouch) + { + _lastTwoFingerDistance = currentDis; + _isTwoFingerTouch = true; + } + else + { + float delta = currentDis - _lastTwoFingerDistance; + float curScale = _viewContainer.scaleX; + // 缩放灵敏度,按需微调 + curScale += delta * 0.001f; + curScale = Mathf.Clamp(curScale, _minScale, _maxScale); + + // 应用缩放 + _viewContainer.scaleX = curScale; + _viewContainer.scaleY = curScale; + + // 关键:双指缩放后,同步更新滑动条位置 + _zoomSlider.value = GetSliderValueByScale(curScale); + + _lastTwoFingerDistance = currentDis; + } + } + // ========= 单指 = 拖拽平移 ========= + else if (InputHelper.Instance.TouchCount == 1) + { + Touch touch = InputHelper.Instance.GetTouch(0); + // 触摸坐标和鼠标同属Unity屏幕坐标系,统一转成FGUI坐标系 + Vector2 curTouchPos = UnityMouseToFGUIPos(touch.position); + + if (touch.phase == TouchPhase.Began) + { + // 只有在拖拽区域内按下,才开启拖拽 + if (IsInDragArea(curTouchPos)) + { + _lastTouchPos = curTouchPos; + _isDraging = true; + _isTwoFingerTouch = false; + } + + // 只有点击在网格范围内才触发震动 + // if (IsInGridArea(curTouchPos)) + // { + // TriggerVibration(); + // } + } + else if (touch.phase == TouchPhase.Moved && _isDraging) + { + Vector2 offset = curTouchPos - _lastTouchPos; + MoveContainer(offset); + _lastTouchPos = curTouchPos; + } + else if (touch.phase == TouchPhase.Ended || touch.phase == TouchPhase.Canceled) + { + _isDraging = false; + } + } + // 无触摸,重置状态 + else + { + _isTwoFingerTouch = false; + _isDraging = false; + } + } + + protected override void OnOpenBefore(object args) + { + if (Screen.safeArea.y != 0) + {//刘海屏 + ui.panel.y += Screen.safeArea.y - 25; + ui.com_money.y += Screen.safeArea.y- 15; + ui.com_gem.y += Screen.safeArea.y - 15; + ui.btn_signin.y += Screen.safeArea.y - 25; + ui.com_gift.y += Screen.safeArea.y - 15; + ui.btn_wv.y += Screen.safeArea.y - 25; + } + + ui.state.selectedIndex = GameHelper.IsGiftSwitch() ? 1 : 0; + + + //加载配置 + // InitAllLevelData(); + LoadLevelConfig(); + _viewContainer = ui.view_container_parent.panel; + InitGridBounds(); + + // 初始化网格占用数组 + InitGridOccupied(); + + // ========== 新增:对局状态重置 ========== + _heartCount = 3; + _collidedArrows.Clear(); + if(_levelConfig != null) + _remainArrowCount = _levelConfig.arrows.Count; + + InitView(); + + ((com_money)ui.com_money).btn_ch.title = GameHelper.getDesByKey("ch_out_1"); + + if (GameHelper.IsGiftSwitch() && ConfigSystem.GetCommonConf().PiggyBankSwitch == 1) + { + ui.btn_saveingpot.visible = true; + ui.com_gift.visible = true; + } + + GameHelper.IsShowFirstReward(); + + // GameHelper.IsShowPettyReward(); + + GameHelper.ShowStatementView(); + } + + private void RefreshGift(object obj = null) + { + ui.com_gift.text_gift.text = GameHelper.Get102Str((decimal)SaveData.GetSaveObject().saveingpot_ch); + } + + private void Set101(decimal coin = -1) + { + if (coin < 0) + { + coin = DataMgr.Coin.Value; + } + + if (ui.com_gem is com_gold btnCoin) btnCoin.text_gold.text = $"{coin:N0}"; + } + + private void Set102() + { + decimal coin = DataMgr.Ticket.Value; + + if (ui.com_money is com_money comMoney) comMoney.text_gold.text = coin.ToString("0.00"); + } + + public void OnUpdate101(object obj = null) + { + Set101(); + } + + public void OnUpdate102(object obj = null) + { + Set102(); + } + + protected override void OnOpen(object args) + { + } + + protected override void OnHide() + { + } + + protected override void OnDisplay(object args) + { + } + #endregion + + #region 消息监听 + protected override void AddListener() + { + GameDispatcher.Instance.AddListener(GameMsg.reset_game, OnRestartGame); + GameDispatcher.Instance.AddListener(GameMsg.Update102, SetTopCurr); + GameDispatcher.Instance.AddListener(GameMsg.Update101, SetTopCurr); + GameDispatcher.Instance.AddListener(GameMsg.ThemeChange, SetModel); + GameDispatcher.Instance.AddListener(GameMsg.UpdateSpeed, SetSpeed); + GameDispatcher.Instance.AddListener(GameMsg.UseProps, SetUserPorp); + GameDispatcher.Instance.AddListener(GameMsg.StopArrowTouch,OpenOrStopGameInput); + GameDispatcher.Instance.AddListener(GameMsg.refreshGift,RefreshGift); + + } + + protected override void RemoveListener() + { + GameDispatcher.Instance.RemoveListener(GameMsg.reset_game, OnRestartGame); + GameDispatcher.Instance.RemoveListener(GameMsg.Update102, SetTopCurr); + GameDispatcher.Instance.RemoveListener(GameMsg.Update101, SetTopCurr); + GameDispatcher.Instance.RemoveListener(GameMsg.ThemeChange, SetModel); + GameDispatcher.Instance.RemoveListener(GameMsg.UpdateSpeed, SetSpeed); + GameDispatcher.Instance.RemoveListener(GameMsg.UseProps, SetUserPorp); + GameDispatcher.Instance.RemoveListener(GameMsg.StopArrowTouch, OpenOrStopGameInput); + GameDispatcher.Instance.RemoveListener(GameMsg.refreshGift,RefreshGift); + + + + + } + #endregion + + #region 页面初始化 + private bool _initComplete = false; + private void InitView() + { + // 重置手势状态 + _isTwoFingerTouch = false; + _isDraging = false; + + + ui.text_level.SetVar("lv", GameHelper.GetLevel().ToString()).FlushVars(); + + // 按钮点击事件绑定 + OnBtnClickBindEvent(); + + //爱心重新更新显示 + for (int i = _heartCount; i > 0; i--) + { + ui.HeartsPanel.GetChild($"xin_{i}").visible = true; + } + + // ui.ch_progress.value = DataMgr.ArrowChProgress.Value; + + _currentTipArrow = null; + + _zoomSlider = ui.com_bottom.zoomSlide; + // 2. 绑定滑动条拖动回调 + _zoomSlider.onChanged.Add(OnZoomSliderChange); + // 3. 容器初始缩放、位置 + // _viewContainer.scaleX = 1f; + // _viewContainer.scaleY = 1f; + // // 滑动条初始居中(对应 1.0 缩放) + // float initValue = GetSliderValueByScale(1f); + // _zoomSlider.value = initValue; + // 先兜底重置为默认锚点 + _viewContainer.pivot = new Vector2(0, 0); + + if (_levelConfig == null) + { + _initComplete = true; + return; + } + + // 第一步:绘制网格 → 内部会计算网格中心、修改pivot为网格中心 + DrawGridDots(_levelConfig); + + // ===== 新增:计算并应用初始缩放 ===== + float initialScale = CalculateInitialScale(); + _viewContainer.scaleX = initialScale; + _viewContainer.scaleY = initialScale; + + // 同步滑动条位置(假设滑动条映射范围为 _minScale~_maxScale) + float sliderValue = GetSliderValueByScale(initialScale); + _zoomSlider.value = Mathf.Clamp(sliderValue, 0f, 100f); // 确保不越界 + + // ========== 核心:把网格中心钉在屏幕中心 ========== + // _gridWorldCenter 是 DrawGridDots 里 CalculateGridCenter 算出的值 + float screenCenterX = ui.view_container_parent.width * 0.5f; + float screenCenterY = ui.view_container_parent.height * 0.5f; + + // 计算容器需要移动多少,才能让网格中心正好对准屏幕中心 + float targetContainerX = screenCenterX - _gridWorldCenter.x; + float targetContainerY = screenCenterY - _gridWorldCenter.y; + + // 直接设置容器位置 + _viewContainer.SetPosition(targetContainerX, targetContainerY, 0); + // ================================================== + + foreach (var arrow in _levelConfig.arrows) + { + BuildArrowPath(arrow, _levelConfig); + CreateArrowAndLines(arrow, _levelConfig); + MarkArrowOccupiedCells(arrow, _levelConfig); + } + + _initComplete = true; + + SetModel(); + + SetTopCurr(); + + Set101(); + + RefreshGift(); + + _fingerTipObj = com_finger.CreateInstance(); + _viewContainer.AddChild(_fingerTipObj); + _fingerTipObj.visible = false; + _fingerTipObj.touchable = false; + _fingerTipObj.sortingOrder = 9999; + + + if (GameHelper.IsShowOpenGameUI() && HallManager.Instance.openTipsTimes >= 1) + { + UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.OpenGameUI_Open); + } + + } + + private float CalculateInitialScale() + { + if (_levelConfig == null) return 0.8f; // 保底 + + int cols = _levelConfig.gridCols; + int rows = _levelConfig.gridRows; + float spacing = _levelConfig.pointSpacing; + + // 网格实际像素宽高 + float gridWidth = (cols - 1) * spacing; + float gridHeight = (rows - 1) * spacing; + + // 容器有效尺寸(可减去固定边距,如 40px) + float margin = 80f; + float containerWidth = ui.view_container_parent.width - margin * 2; + float containerHeight = ui.view_container_parent.height - margin * 2; + + // 边界保护(网格可能只有一行/列) + if (gridWidth <= 0) gridWidth = 1f; + if (gridHeight <= 0) gridHeight = 1f; + + float scaleX = containerWidth / gridWidth; + float scaleY = containerHeight / gridHeight; + + float scale = Mathf.Min(scaleX, scaleY); + + // 限制上限(避免网格过大时缩放太小;下限由滑动条范围决定,建议调整 _minScale) + scale = Mathf.Clamp(scale, _minScale, _maxScale); // 下限设 0.3 更合理 + return scale; + } + + private void SetTopCurr(object a = null) + { + if (ui.com_money is com_money btnMoney) + { + btnMoney.text_gold.text = DataMgr.Ticket.Value.ToString("0.00"); + btnMoney.SetClick(PopMakeup); + } + } + + private void PopMakeup() + { + var makeupTaskData = DataMgr.MakeupTaskHistory.Value.Last(); + var vo = MakeupModel.GetData(makeupTaskData.tableId); + if (vo == null) + { + Debug.LogError("MakeupTaskData 为空"); + return; + } + GameHelper.showGameUI = false; + uiCtrlDispatcher.Dispatch(UICtrlMsg.MakeupConfirmUI_Open, makeupTaskData); + } + + #endregion + + #region UI相关 + + private void OnBtnClickBindEvent() + { + ui.btn_close.SetClick(CtrlCloseUI); + ui.com_bottom.btn_clear.SetClick(OnClickDeleteItem); + ui.com_bottom.btn_hint.SetClick(OnClickHint); + + ui.com_bottom.btn_setting.SetClick(() => + { + uiCtrlDispatcher.Dispatch(UICtrlMsg.ArrowSettingUI_Open, _moveSpeed); + }); + + if (!GameHelper.IsGiftSwitch() && ConfigSystem.GetCommonConf().WVswitch == 0) + { + ui.btn_wv.visible = false; + } + ui.btn_wv.SetClick(() => + { + SDKOpenConfig openConfig = new SDKOpenConfig + { + normal = true, + url = "" + }; + CtrlDispatcher.Instance.Dispatch(CtrlMsg.open_wb,openConfig); + }); + + ui.com_bottom.btn_skin.SetClick(() => { uiCtrlDispatcher.Dispatch(UICtrlMsg.ArrowThemeUI_Open); }); + + ui.btn_petty.SetClick(() => { uiCtrlDispatcher.Dispatch(UICtrlMsg.PettyAwardUI_Open); }); + + ui.btn_signin.SetClick(() => { uiCtrlDispatcher.Dispatch(UICtrlMsg.SignInUI_Open); }); + + ui.btn_statement.SetClick(() => { uiCtrlDispatcher.Dispatch(UICtrlMsg.StatementViewUI_Open); }); + + ui.btn_saveingpot.SetClick(() => { uiCtrlDispatcher.Dispatch(UICtrlMsg.SaveingPotUI_Open); }); + + ui.com_gift.SetClick(() => { uiCtrlDispatcher.Dispatch(UICtrlMsg.SaveingPotUI_Open); }); + } + + + // 缓存上一次箭头主题,用于判断是否需要重新随机彩色 + private int _lastArrowTheme = -1; + /// + /// 主题变更统一回调(昼夜/箭头主题切换都会触发) + /// + private void SetModel(object a = null) + { + int darkThemeIdx = DataMgr.ArrowDarkTheme.Value; + int currentArrowTheme = DataMgr.ArrowTheme.Value; + + ui.mode.selectedIndex = darkThemeIdx; + + // 1. 更新网格圆点昼夜配色 + bool isDarkMode = darkThemeIdx == 0; // 0=黑夜 + Debug.Log($"ArrowDarkTheme==={darkThemeIdx}"); + UpdateGridDotColor(isDarkMode); + + // 2. 判断是否需要重新随机彩色:只有从非彩色切到彩色时才刷新 + bool forceRandomColorful = currentArrowTheme == 2 && _lastArrowTheme != currentArrowTheme; + + // 3. 更新所有箭头颜色 + UpdateAllArrowsColor(forceRandomColorful); + + // 4. 更新缓存,用于下次对比 + _lastArrowTheme = currentArrowTheme; + + Debug.Log($"主题刷新完成:昼夜={darkThemeIdx},箭头主题={currentArrowTheme}"); + } + /// + /// 批量设置网格圆点颜色(随昼夜模式切换) + /// // 色值映射:白天#2c3a62,黑夜#d4e3f2 + /// + /// true=黑夜模式,false=白天模式 + + private string DarkColor = "#d4e3f2"; + private string LightColor = "#2c3a62"; + private void UpdateGridDotColor(bool isDay) + { + if (_gridDotList == null || _gridDotList.Count == 0) + return; + + + Debug.Log($"isDay=========={isDay}"); + string colorHex = isDay ? DarkColor : LightColor; + ColorUtility.TryParseHtmlString(colorHex, out Color targetColor); + + foreach (var dot in _gridDotList) + { + if (dot == null) continue; + + dot.point.color = targetColor; + } + } + + /// + /// 根据当前主题,为单个箭头生成对应颜色 + /// + /// 箭头配置对象 + /// 彩色模式下是否重新随机颜色 + private Color GetArrowRuntimeColor(ArrowConfig arrow, bool isRandomNew = false) + { + int themeType = DataMgr.ArrowTheme.Value; + + // 0 = 纯色模式(黑色按钮):白天黑、黑夜白 + if (themeType == 0) + { + bool isDark = DataMgr.ArrowDarkTheme.Value == 0; // 0=黑夜 + return isDark ? Color.white : Color.black; + } + // 2 = 彩色随机模式 + else if (themeType == 2) + { + if (isRandomNew || arrow.runtimeColor == default) + { + int randomIndex = Random.Range(0, _colorfulPalette.Length); + arrow.runtimeColor = _colorfulPalette[randomIndex]; + } + return arrow.runtimeColor; + } + + // 兜底默认黑色 + return Color.black; + } + + /// 批量更新场上所有箭头的颜色(线条+单箭头) + /// + /// 彩色模式下是否强制重新随机 + private void UpdateAllArrowsColor(bool forceRandomColorful = false) + { + if (_levelConfig == null || _levelConfig.arrows == null) + return; + + int themeType = DataMgr.ArrowTheme.Value; + bool isColorfulMode = themeType == 2; + + foreach (var arrow in _levelConfig.arrows) + { + // 只有强制刷新时,彩色模式才重新随机颜色 + bool isRandomNew = isColorfulMode && forceRandomColorful; + Color targetColor = GetArrowRuntimeColor(arrow, isRandomNew); + + // 更新线条颜色 + if (arrow.lineUnits != null) + { + foreach (var line in arrow.lineUnits) + { + if (line != null) + { + line.GetChild("line").asGraph.color = targetColor; + } + } + } + + // 更新单箭头颜色 + if (arrow.arrowObj != null) + { + GImage icon = arrow.arrowObj.GetChild("icon").asImage; + if (icon != null) + { + icon.color = targetColor; + } + } + } + } + + //反馈特效工具 + /// + /// 触发震动反馈 + /// + /// true=强震动(阻挡时用),false=轻震动(普通点击) + private void TriggerVibration(bool isStrong = false) + { + // 编辑器模式跳过震动 +#if UNITY_EDITOR + return; +#endif + + // 通用震动(兼容iOS/安卓,系统默认时长) + // Handheld.Vibrate(); + + Debug.Log($"震动反馈:{isStrong}"); + // ===== 进阶:安卓自定义震动时长(可选开启)===== + if (Application.platform == RuntimePlatform.Android) + { + long duration = isStrong ? 100L : 50L; + AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); + AndroidJavaObject activity = unityPlayer.GetStatic("currentActivity"); + AndroidJavaObject vibrator = activity.Call("getSystemService", "vibrator"); + vibrator.Call("vibrate", duration); + } + } + + /// + /// 触发阻挡时两侧红色闪烁效果 + /// + private void TriggerBlockFlash() + { + ui.t1.Play(); + + // 先终止正在播放的动画,避免叠加错乱 + ui.com_ficker.visible = true; + ui.com_ficker.t0.Play(() => + { + ui.com_ficker.visible = false; + }); + + } + + #endregion + + private void InitGridBounds() + { + // 第0列、第0行的起点坐标 + gridLeft = ui.point.x; + gridTop = ui.point.y; + + // 正确计算:(点数 - 1) × 点间距 = 总跨度 + gridRight = ui.point.x + (_levelConfig.gridCols - 1) * _levelConfig.pointSpacing; + gridBottom = ui.point.y + (_levelConfig.gridRows - 1) * _levelConfig.pointSpacing; + } + + /// 初始化网格占用二维数组 + private void InitGridOccupied() + { + int rows = _levelConfig.gridRows; + int cols = _levelConfig.gridCols; + _gridOccupied = new bool[rows, cols]; + // 初始全部置为空闲 + for (int r = 0; r < rows; r++) + for (int c = 0; c < cols; c++) + _gridOccupied[r, c] = false; + + _arrowOccupiedCells.Clear(); + } + + /// 标记单个箭头占用的所有网格点 + private void MarkArrowOccupiedCells(ArrowConfig arrow, LevelConfig cfg) + { + List<(int row, int col)> cellList = new List<(int row, int col)>(); + int totalCol = cfg.gridCols; + + // 遍历箭头整条路径的所有网格点位 + foreach (var pos in arrow.pathPointList) + { + int pointId = GetPointIdByPos(pos, cfg); + PointIdToRowCol(pointId, totalCol, out int r, out int c); + + // 边界保护 + if (r >= 0 && r < cfg.gridRows && c >= 0 && c < cfg.gridCols) + { + _gridOccupied[r, c] = true; + cellList.Add((r, c)); + } + } + + _arrowOccupiedCells[arrow] = cellList; + } + + /// 释放单个箭头占用的网格(箭头消失时调用) + private void ReleaseArrowOccupied(ArrowConfig arrow) + { + if (!_arrowOccupiedCells.TryGetValue(arrow, out var cellList)) + return; + + foreach (var (r, c) in cellList) + { + if (r >= 0 && r < _levelConfig.gridRows && c >= 0 && c < _levelConfig.gridCols) + { + _gridOccupied[r, c] = false; + } + } + // 移除字典记录,避免冗余 + _arrowOccupiedCells.Remove(arrow); + } + + #region 配置加载 + private void LoadLevelConfig() + { + // _levelConfig = JsonHelper.LoadLevel("level_1001.json"); + // 示例:加载第1关 levelId=0 + int currentLevelId = GameHelper.GetLevel(); + + // 替换为:按ID加载单关 + bool loadSuccess = LevelManager.Instance.LoadLevel(currentLevelId); + if (!loadSuccess) + { + // 加载失败兜底(比如回到第一关) + return; + } + + // 直接取当前关卡配置,后续逻辑完全不变 + _levelConfig = LevelManager.Instance.CurrentLevel; + + // if (_allLevelData.levels.Count < currentLevelId) currentLevelId = _allLevelData.levels.Count; + // _levelConfig = LoadLevelById(currentLevelId); + // // 给 path 为空的箭头,设置默认方向 + // foreach (var arrow in _levelConfig.arrows) + // { + // if (arrow.path == null || arrow.path.Count == 0) + // { + // arrow.defaultDir = "up"; + // } + // else + // { + // arrow.defaultDir = null; + // } + // } + } + + /// + /// 从 all_levels.json 中按 levelId 读取指定关卡 + /// + /// 目标关卡ID 如 1001 + /// 找到返回关卡数据,没找到返回null + /// + private static AllLevelRoot _allLevelData; + // 游戏启动时调用一次 + public static void InitAllLevelData() + { + string path = Path.Combine(Application.streamingAssetsPath, "all_levels.json"); +#if UNITY_ANDROID && !UNITY_EDITOR + // Android 平台需要使用 UnityWebRequest 读取 StreamingAssets + using (UnityEngine.Networking.UnityWebRequest www = UnityEngine.Networking.UnityWebRequest.Get(path)) + { + www.SendWebRequest(); + while (!www.isDone) { } + + if (www.result == UnityEngine.Networking.UnityWebRequest.Result.Success) + { + string json = www.downloadHandler.text; + _allLevelData = JsonUtility.FromJson(json); + } + else + { + Debug.LogError($"Failed to load all_levels.json: {www.error}"); + } + } +#else + // Editor 和其他平台直接读取 + string json = File.ReadAllText(path); + _allLevelData = JsonUtility.FromJson(json); +#endif + + } + + public static LevelConfig LoadLevelById(int targetLevelId) + { + AllLevelRoot root = _allLevelData; + if (root == null || root.levels == null) return null; + + // 遍历查找对应关卡 + foreach (var lv in _allLevelData.levels) + { + if (lv.levelId == targetLevelId) + { + return lv; + } + } + Debug.LogWarning($"未找到关卡ID: {targetLevelId}"); + return null; + } + #endregion + + #region 【核心】网格坐标工具 + /// 点位ID 转 行列索引 + private void PointIdToRowCol(int pointId, int totalCol, out int row, out int col) + { + row = pointId / totalCol; + col = pointId % totalCol; + } + + /// 行列 → 实际像素坐标 + private Vector2 RowColToPos(int row, int col) + { + float originX = ui.point.x; + float originY = ui.point.y; + float x = originX + col * _levelConfig.pointSpacing; + float y = originY + row * _levelConfig.pointSpacing; + return new Vector2(x, y); + } + + /// 点位ID → 最终像素坐标 + private Vector2 PointIdToPos(int pointId, int totalCol) + { + PointIdToRowCol(pointId, totalCol, out int r, out int c); + return RowColToPos(r, c); + } + + /// 像素坐标反向计算点位ID + private int GetPointIdByPos(Vector2 pos, LevelConfig cfg) + { + float originX = ui.point.x; + float originY = ui.point.y; + + int col = Mathf.RoundToInt((pos.x - originX) / cfg.pointSpacing); + int row = Mathf.RoundToInt((pos.y - originY) / cfg.pointSpacing); + + return row * cfg.gridCols + col; + } + + /// 根据FGUI旋转角度获取方向 + private string GetDirByRotation(float rot) + { + rot = Mathf.Round(rot); + if (rot == 0) return "right"; + if (rot == 90) return "down"; + if (rot == 180) return "left"; + if (rot == 270) return "up"; + return "right"; + } + + /// 方向转旋转角度(箭头默认朝上) + private float DirToRotation(string dir) + { + return dir switch + { + "up" => 0f, + "right" => 90f, + "down" => 180f, + "left" => 270f, + _ => 0f + }; + } + #endregion + + #region 绘制网格圆点 + private void DrawGridDots(LevelConfig cfg) + { + var rows = cfg.gridRows; + var cols = cfg.gridCols; + + for (var r = 0; r < rows; r++) + { + for (var c = 0; c < cols; c++) + { + var dot = ArrorPoint.CreateInstance(); + var pos = RowColToPos(r, c); + dot.SetPosition(pos.x, pos.y, 0); + _viewContainer.AddChild(dot); + // 加入列表统一管理 + _gridDotList.Add(dot); + + } + } + + // ========= 网格绘制完成后,设置居中缩放轴心 ========= + CalculateGridCenter(cfg); + SetViewPivotToGridCenter(); + } + + /// 计算整个网格圆点区域的世界中心点 + private void CalculateGridCenter(LevelConfig cfg) + { + int rows = cfg.gridRows; + int cols = cfg.gridCols; + + // 取四个角点位,算出整体中心 + Vector2 topLeft = RowColToPos(0, 0); + Vector2 bottomRight = RowColToPos(rows - 1, cols - 1); + + // 几何中心 + _gridWorldCenter.x = (topLeft.x + bottomRight.x) * 0.5f; + _gridWorldCenter.y = (topLeft.y + bottomRight.y) * 0.5f; + } + + /// 设置_viewContainer缩放轴心 = 网格中心,实现居中缩放 + private void SetViewPivotToGridCenter() + { + if (_viewContainer == null) return; + + // FGUI pivot 取值范围 0~1,是容器内部相对比例 + float pivotX = _gridWorldCenter.x / _viewContainer.width; + float pivotY = _gridWorldCenter.y / _viewContainer.height; + + // 限制在合法区间 + pivotX = Mathf.Clamp01(pivotX); + pivotY = Mathf.Clamp01(pivotY); + + // 设置轴心,此后所有缩放都围绕网格中心 + _viewContainer.pivot = new Vector2(pivotX, pivotY); + } + #endregion + + #region 构建箭头路径点位 + private void BuildArrowPath(ArrowConfig arrow, LevelConfig cfg) + { + arrow.pathPointList = new List(); + int totalCol = cfg.gridCols; + + int curPointId = arrow.startPoint; + Vector2 curPos = PointIdToPos(curPointId, totalCol); + arrow.pathPointList.Add(curPos); + + foreach (string dir in arrow.path) + { + PointIdToRowCol(curPointId, totalCol, out int r, out int c); + switch (dir) + { + case "up": r--; break; + case "down": r++; break; + case "left": c--; break; + case "right": c++; break; + } + + curPointId = r * totalCol + c; + curPos = PointIdToPos(curPointId, totalCol); + arrow.pathPointList.Add(curPos); + } + } + #endregion + + #region 创建箭头 + 线条方块 + private void CreateArrowAndLines(ArrowConfig arrow, LevelConfig cfg) + { + arrow.lineUnits = new List(); + arrow.originalLinePos = new List(); + arrow.lineTrackIndex = new List(); + arrow.totalTrack = new List(); + List pathPoints = arrow.pathPointList; + + // 生成整条连续行走轨迹 + if (pathPoints.Count >= 2) + { + for (int i = 0; i < pathPoints.Count - 1; i++) + { + Vector2 segStart = pathPoints[i]; + string dir = arrow.path[i]; + float offX = 0, offY = 0; + switch (dir) + { + case "right": offX = 10; break; + case "left": offX = -10; break; + case "down": offY = 10; break; + case "up": offY = -10; break; + } + + Vector2 cur = segStart; + for (int k = 0; k < 6; k++) + { + arrow.totalTrack.Add(cur); + cur.x += offX; + cur.y += offY; + } + } + + if (arrow.path.Count > 0) + arrow.finalMoveDir = arrow.path[arrow.path.Count - 1]; + } + + // 路径只有单个点(纯箭头) + if (pathPoints.Count < 2) + { + CreateArrowOnly(arrow, pathPoints[0]); + // ========= 修复1:单点箭头也初始化轨迹索引 ========= + arrow.arrowTrackIndex = 0; + arrow.finalMoveDir = GetDirByRotation(arrow.arrowObj.rotation); + // ========= 修复2:强制记录原始坐标(关键!)========= + arrow.originalArrowPos = new Vector2(arrow.arrowObj.x, arrow.arrowObj.y); + // 优化:给单点箭头填充一个轨迹点,和有线箭头逻辑完全一致 + arrow.totalTrack.Add(pathPoints[0]); + return; + } + + // 生成线条图块 + List tilePositions = new List(); + for (int i = 0; i < pathPoints.Count - 1; i++) + { + Vector2 segStart = pathPoints[i]; + string dir = arrow.path[i]; + float offX = 0, offY = 0; + switch (dir) + { + case "right": offX = 10; break; + case "left": offX = -10; break; + case "down": offY = 10; break; + case "up": offY = -10; break; + } + + Vector2 cur = segStart; + for (int k = 0; k < 6; k++) + { + tilePositions.Add(cur); + cur.x += offX; + cur.y += offY; + } + } + + if (tilePositions.Count > 0) + tilePositions.RemoveAt(tilePositions.Count - 1); + + for (int i = 0; i < tilePositions.Count; i++) + { + Vector2 pos = tilePositions[i]; + LineTile unit = LineTile.CreateInstance(); + unit.SetPosition(pos.x, pos.y, 0); + // 运行时主题取色 + Color lineColor = GetArrowRuntimeColor(arrow); + unit.GetChild("line").asGraph.color = lineColor; + unit.visible = true; + unit.touchable = true; + unit.name = "Arrow_" + arrow.id; + unit.onClick.Add(() => OnPathClick(arrow)); + + _viewContainer.AddChild(unit); + arrow.lineUnits.Add(unit); + arrow.originalLinePos.Add(pos); + arrow.lineTrackIndex.Add(i); + } + + // 创建箭头 + CreateArrowOnly(arrow, pathPoints[pathPoints.Count - 1]); + arrow.originalArrowPos = new Vector2(arrow.arrowObj.x, arrow.arrowObj.y); + arrow.arrowTrackIndex = arrow.totalTrack.Count - 1; + + + + // ========== 初始化距离偏移 ========== + arrow.movedDistance = 0f; + // 轨迹总长度 = (点数-1) * 点间距 + arrow.trackTotalLength = (arrow.totalTrack.Count - 1) * 10f; + // 箭头初始在轨迹末端 + arrow.arrowInitOffset = arrow.trackTotalLength; + + // 每个线条的初始偏移 = 索引 * 点间距 + arrow.lineInitOffsets = new List(); + for (int i = 0; i < arrow.lineUnits.Count; i++) + { + arrow.lineInitOffsets.Add(i * 10f); + } + } + #endregion + + + #region 道具(删除和提示) + private void SetUserPorp(object a) + { + + if (a != null) + { + var type = (int)a; + Debug.Log($"Set User Prop: {type}"); + if (type == 0) + { + // 提示道具 + ShowRandomArrowTip(); + } + else if (type == 1) + { + _isDeleteMode = !_isDeleteMode; + GameHelper.ShowTips("You can delete any one of the arrows!"); + } + } + + } + /// 点击删除道具,开启/关闭删除模式 + private void OnClickDeleteItem() + { + // _isDeleteMode = !_isDeleteMode; + + UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.ArrowTipsUI_Open, 1); + + // // 可选:加提示,区分状态 + // if (_isDeleteMode) + // { + // Debug.Log("已开启删除模式,点击箭头即可删除"); + // // 可加UI提示:如图标高亮、文字提示 + // } + // else + // { + // Debug.Log("已关闭删除模式"); + // } + } + + private void OnClickHint() + { + UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.ArrowTipsUI_Open, 0); + } + + /// 随机选中有效箭头,显示静态手指提示(不跟随移动) + private void ShowRandomArrowTip() + { + // 先隐藏上一次提示 + HideFingerTip(); + + if (_levelConfig == null || _levelConfig.arrows == null || _levelConfig.arrows.Count == 0) + { + Debug.Log("暂无可提示的箭头"); + return; + } + + // 筛选条件:对象存在 + 未销毁 + 未在移动中 + 前方无阻挡可直接消除 + List validArrows = _levelConfig.arrows + .Where(arrow => + arrow != null && + arrow.arrowObj != null && + !arrow.isMoving && + !IsArrowBlocked(arrow)) + .ToList(); + + if (validArrows.Count == 0) + { + Debug.Log("当前没有可直接消除的箭头,无法提示"); + return; + } + + // 从可消除箭头中随机选一个 + int randomIndex = Random.Range(0, validArrows.Count); + _currentTipArrow = validArrows[randomIndex]; + + // 设置手指提示位置 + float x = _currentTipArrow.arrowObj.x + _fingerOffset.x; + float y = _currentTipArrow.arrowObj.y + _fingerOffset.y; + _fingerTipObj.SetPosition(x, y, 0); + _fingerTipObj.visible = true; + } + + /// 隐藏手指提示并清空标记 + private void HideFingerTip() + { + if (_fingerTipObj != null) + { + _fingerTipObj.visible = false; + } + _currentTipArrow = null; + } + #endregion + + + #region 缩放 + + /// + /// 判断FGUI全局坐标是否落在拖拽有效区域(view_container_parent)内 + /// + private bool IsInDragArea(Vector2 fguiGlobalPos) + { + if (ui.view_container_parent == null) + return false; + + // 全局坐标转成父容器本地坐标(左上角为原点) + Vector2 localPos = ui.view_container_parent.GlobalToLocal(fguiGlobalPos); + + // 判断是否在容器矩形范围内 + return localPos.x >= 0 + && localPos.x <= ui.view_container_parent.width + && localPos.y >= 0 + && localPos.y <= ui.view_container_parent.height; + } + /// + /// 判断FGUI全局坐标是否落在圆点网格范围内 + /// + private bool IsInGridArea(Vector2 fguiGlobalPos) + { + if (_viewContainer == null || _levelConfig == null) + return false; + + // 全局坐标转成 _viewContainer 本地坐标(网格坐标基于该容器) + Vector2 localPos = _viewContainer.GlobalToLocal(fguiGlobalPos); + + // 和网格四边边界比对 + return localPos.x >= gridLeft + && localPos.x <= gridRight + && localPos.y >= gridTop + && localPos.y <= gridBottom; + } + + /// 根据缩放值,计算滑动条 value(0~1) + private float GetSliderValueByScale(float scale) + { + float validScale = Mathf.Clamp(scale, _minScale, _maxScale); + float ratio = (validScale - _minScale) / (_maxScale - _minScale); + float sliderVal = ratio * 100f; + + return Mathf.Clamp(sliderVal, 0f, 100f); + } + + /// 根据滑动条 value(0~1),计算实际缩放值 + private float GetScaleBySliderValue(float sliderValue) + { + // 先把滑块值钳位在 0~100 内 + float val = Mathf.Clamp(sliderValue, 0f, 100f); + + // 线性映射:0→0.6,100→1.5 + float ratio = val / 100f; + float scale = _minScale + ratio * (_maxScale - _minScale); + + return Mathf.Clamp(scale, _minScale, _maxScale); + } + + /// 滑动条数值变化回调 + private void OnZoomSliderChange() + { + float scale = GetScaleBySliderValue((float)_zoomSlider.value); + _viewContainer.scaleX = scale; + _viewContainer.scaleY = scale; + } + + /// 移动容器 + 边界限制,防止完全拖出屏幕 + private void MoveContainer(Vector2 offset) + { + Debug.Log($"[arrow] 移动容器:{offset}"); + float newX = _viewContainer.x + offset.x; + float newY = _viewContainer.y + offset.y; + + float viewW = _viewContainer.width * _viewContainer.scaleX; + float viewH = _viewContainer.height * _viewContainer.scaleY; + + // 左右边界 + float minX = -viewW + _dragBorder; + float maxX = Screen.width - _dragBorder; + newX = Mathf.Clamp(newX, minX, maxX); + + // 上下边界 + float minY = -viewH + _dragBorder; + float maxY = Screen.height - _dragBorder; + newY = Mathf.Clamp(newY, minY, maxY); + + _viewContainer.SetPosition(newX, newY,0); + } + + #endregion + + + #region 点击 & 移动逻辑 + + // 线条/箭头 统一点击回调 + private void OnPathClick(ArrowConfig clickArrow) + { + if (clickArrow.isMoving) + { + Debug.Log($"[arrow] {clickArrow.id}正在移动,请勿点击其他箭头"); + return; + } + + TriggerVibration(true); + + + // 点击的是当前提示箭头,直接隐藏手指 + if (_currentTipArrow == clickArrow) + { + HideFingerTip(); + } + + // ========= 删除模式:直接删除箭头,不走移动逻辑 ========= + if (_isDeleteMode) + { + DeleteArrowCompletely(clickArrow); + return; + } + + clickArrow.isMoving = true; + bool hasBlock = CheckBlockByGrid(clickArrow); + Debug.Log("[arrow] 点击箭头 id:" + clickArrow.id +$" hasBlock=阻挡=={hasBlock}"); + if (hasBlock) + { + MoveThenReset(clickArrow); + } + else + { + MoveToDisappear(clickArrow); + } + } + + /// + /// 纯检测:箭头前方是否有阻挡(无副作用,不扣血、不改状态) + /// + /// true=前方有阻挡,false=可直接飞出消除 + private bool IsArrowBlocked(ArrowConfig curArrow) + { + if (_gridOccupied == null || _levelConfig == null) + return false; + + // 获取箭头头部所在网格行列 + Vector2 arrowPos = new Vector2(curArrow.arrowObj.x, curArrow.arrowObj.y); + int curPointId = GetPointIdByPos(arrowPos, _levelConfig); + PointIdToRowCol(curPointId, _levelConfig.gridCols, out int curRow, out int curCol); + + // 箭头已超出网格,判定无阻挡 + if (curRow < 0 || curRow >= _levelConfig.gridRows || curCol < 0 || curCol >= _levelConfig.gridCols) + return false; + + // 获取最终射出方向 + string moveDir; + if (curArrow.path != null && curArrow.path.Count > 0) + { + moveDir = curArrow.path[curArrow.path.Count - 1]; + } + else if (!string.IsNullOrEmpty(curArrow.defaultDir)) + { + moveDir = curArrow.defaultDir; + } + else + { + moveDir = "up"; + } + + // 沿射出方向遍历前方网格 + switch (moveDir) + { + case "up": + for (int r = curRow - 1; r >= 0; r--) + { + if (_gridOccupied[r, curCol]) + return true; + } + break; + case "down": + for (int r = curRow + 1; r < _levelConfig.gridRows; r++) + { + if (_gridOccupied[r, curCol]) + return true; + } + break; + case "left": + for (int c = curCol - 1; c >= 0; c--) + { + if (_gridOccupied[curRow, c]) + return true; + } + break; + case "right": + for (int c = curCol + 1; c < _levelConfig.gridCols; c++) + { + if (_gridOccupied[curRow, c]) + return true; + } + break; + } + + return false; + } + // 基于网格行列的阻挡检测(带扣血逻辑,点击箭头时调用) + private bool CheckBlockByGrid(ArrowConfig curArrow) + { + bool isCollide = IsArrowBlocked(curArrow); + + // ========== 碰撞判重 + 扣爱心 ========== + if (isCollide) + { + // 同个箭头第一次碰撞才扣血 + if (!_collidedArrows.Contains(curArrow)) + { + _collidedArrows.Add(curArrow); + _heartCount--; + + if (_heartCount > 0) + ui.HeartsPanel.GetChild($"xin_{_heartCount + 1}").visible = false; + + // 爱心归零 → 失败结算 + if (_heartCount <= 0) + { + ShowResult(false); + } + } + } + + return isCollide; + } + + /// + /// 计算箭头沿射出方向,到前方第一个阻挡点的前移距离(像素) + /// + /// 目标箭头 + /// 碰撞预留余量,离阻挡点还差多少像素就停下回弹 + /// 实际前移的总像素距离 + private float GetDistanceToFirstBlock(ArrowConfig arrow, float hitMargin = 20f) + { + if (_gridOccupied == null || _levelConfig == null) + return 20f; // 异常兜底,保持原默认值 + + // 计算箭头头部所在的网格坐标(路径终点) + int curRow = arrow.startPoint / _levelConfig.gridCols; + int curCol = arrow.startPoint % _levelConfig.gridCols; + + // 沿路径走到终点,定位箭头头部网格位置 + foreach (string dir in arrow.path) + { + switch (dir) + { + case "up": curRow--; break; + case "down": curRow++; break; + case "left": curCol--; break; + case "right": curCol++; break; + } + } + + string moveDir = GetFinalMoveDir(arrow); + int emptyGridCount = 0; + + // 沿射出方向逐格检测第一个阻挡 + while (true) + { + // 前进一步 + switch (moveDir) + { + case "up": curRow--; break; + case "down": curRow++; break; + case "left": curCol--; break; + case "right": curCol++; break; + } + + // 出界无阻挡,兜底返回默认距离 + if (curRow < 0 || curRow >= _levelConfig.gridRows + || curCol < 0 || curCol >= _levelConfig.gridCols) + { + return 20f; + } + + // 找到阻挡点 + if (_gridOccupied[curRow, curCol]) + { + // 总距离 = 空格数*点间距 + (单格距离 - 预留余量) + float total = (emptyGridCount + 1) * _levelConfig.pointSpacing - hitMargin; + // 最小前移保护,避免阻挡太近时几乎没动画 + return Mathf.Max(total, 6f); + } + + emptyGridCount++; + } + } + + /// 彻底删除指定箭头:销毁UI+清数据+停逻辑+移除列表 + private void DeleteArrowCompletely(ArrowConfig arrow) + { + if (arrow == null) return; + + // 被删除的是提示箭头,隐藏手指 + if (_currentTipArrow == arrow) + { + HideFingerTip(); + } + + // 1. 停止移动标记,拦截Update和协程 + arrow.isMoving = false; + + // 2. 销毁箭头中所有线条UI + if (arrow.lineUnits != null) + { + foreach (var line in arrow.lineUnits) + { + if (line != null) + { + _viewContainer.RemoveChild(line); + line.Dispose(); + } + } + arrow.lineUnits.Clear(); + } + + // 3. 销毁箭头本体UI + if (arrow.arrowObj != null) + { + _viewContainer.RemoveChild(arrow.arrowObj); + arrow.arrowObj.Dispose(); + arrow.arrowObj = null; + } + + // 4. 释放网格占用数据(和飞出边界逻辑保持一致) + ReleaseArrowOccupied(arrow); + + // 5. 存活箭头计数-1 + _remainArrowCount--; + + // 6. 从总列表移除该箭头(核心:删除数据源) + if (_levelConfig != null && _levelConfig.arrows != null) + { + _levelConfig.arrows.Remove(arrow); + } + + // 7. 可选:判断是否全部删除完成,触发结算(按需开启) + if (_remainArrowCount <= 0) + { + ShowResult(true); + } + else + { + // 消除每条线小概率触发 + DisappearLineGetReward(); + } + // 8. 退出删除模式 + _isDeleteMode = false; + Debug.Log("[arrow] 箭头已彻底删除"); + } + + // 创建箭头 + 绑定点击 + private void CreateArrowOnly(ArrowConfig arrow, Vector2 arrowPos) + { + ArrowEnd arrowIns = ArrowEnd.CreateInstance(); + arrowIns.SetPosition(arrowPos.x, arrowPos.y, 0); + arrowIns.touchable = true; + + if (arrow.path != null && arrow.path.Count > 0) + { + string lastDir = arrow.path[arrow.path.Count - 1]; + arrowIns.rotation = DirToRotation(lastDir); + } + else if (!string.IsNullOrEmpty(arrow.defaultDir)) + { + // 纯单点箭头 使用默认方向旋转 + arrowIns.rotation = DirToRotation(arrow.defaultDir); + } + + // 运行时主题取色 + Color arrowColor = GetArrowRuntimeColor(arrow); + GImage icon = arrowIns.GetChild("icon").asImage; + if (icon != null) icon.color = arrowColor; + + arrowIns.visible = true; + arrowIns.name = "Arrow_" + arrow.id; + arrowIns.onClick.Add(() => OnPathClick(arrow)); + _viewContainer.AddChild(arrowIns); + + arrow.arrowObj = arrowIns; + arrow.isMoving = false; + } + + // 移动后复位动画(回弹,不释放占用) + private void MoveThenReset(ArrowConfig arrow) + { + RunCoroutine(MoveAndResetCoroutine(arrow)); + } + + private readonly float _bounceSpeed = 1200f; + private IEnumerator MoveAndResetCoroutine(ArrowConfig arrow) + { + arrow.movedDistance = 0f; + arrow.finalMoveDir = GetFinalMoveDir(arrow); + + // 动态计算:前移到快碰到阻挡点的距离 + float forwardTotal = GetDistanceToFirstBlock(arrow, 3f); + float duration = forwardTotal / _bounceSpeed; + float timer = 0f; + + // ========== 第一段:向前移动到快碰到阻挡 ========== + while (timer < duration) + { + if (arrow == null || arrow.arrowObj == null) yield break; + + timer += Time.deltaTime; + arrow.movedDistance = Mathf.Min(_bounceSpeed * timer, forwardTotal); + + UpdateAllElementsPosition(arrow); + yield return null; + } + + // 核心:阻挡强震动 + 红色氛围闪烁 + TriggerBlockFlash(); + + // 强制对齐前移终点,消除浮点误差 + arrow.movedDistance = forwardTotal; + UpdateAllElementsPosition(arrow); + + // ========== 直接瞬间复位(删除原渐变回弹逻辑)========== + // 可选:加 1 帧停顿,模拟碰撞卡顿感,觉得突兀就打开注释 + // yield return null; + + // 距离归零 + 原始坐标强制校准,双保险保证精准回到初始位置 + arrow.movedDistance = 0f; + UpdateAllElementsPosition(arrow); + + if (arrow.arrowObj != null) + { + arrow.arrowObj.SetPosition(arrow.originalArrowPos.x, arrow.originalArrowPos.y, 0); + } + for (int i = 0; i < arrow.lineUnits.Count; i++) + { + if (arrow.lineUnits[i] != null && i < arrow.originalLinePos.Count) + { + arrow.lineUnits[i].SetPosition( + arrow.originalLinePos[i].x, + arrow.originalLinePos[i].y, 0); + } + } + + arrow.isMoving = false; + } + + /// 统一更新箭头+所有线条的位置 + private void UpdateAllElementsPosition(ArrowConfig arrow) + { + for (int i = 0; i < arrow.lineUnits.Count; i++) + { + float curDist = arrow.lineInitOffsets[i] + arrow.movedDistance; + Vector2 pos = GetPositionByDistance(arrow, curDist); + arrow.lineUnits[i].SetPosition(pos.x, pos.y, 0); + } + + float arrowCurDist = arrow.arrowInitOffset + arrow.movedDistance; + Vector2 arrowPos = GetPositionByDistance(arrow, arrowCurDist); + arrow.arrowObj.SetPosition(arrowPos.x, arrowPos.y, 0); + } + + private void MoveToDisappear(ArrowConfig arrow) + { + RunCoroutine(MoveAndDisappearCoroutine(arrow)); + } + + + private void SetSpeed(object a = null) + { + if (a != null) + { + _moveSpeed = (float)a; + } + } + + // 新增:统一移动速度(像素/秒),数值越大移动越快,可自由修改 + [SerializeField] private float _moveSpeed = 1500f; + private IEnumerator MoveAndDisappearCoroutine(ArrowConfig arrow) + { + arrow.movedDistance = 0f; + arrow.finalMoveDir = GetFinalMoveDir(arrow); + + while (true) + { + // 空对象兜底保护 + if (arrow == null || arrow.arrowObj == null) + { + yield break; + } + + // 每帧累计移动距离:速度 * 时间增量 + float deltaDis = _moveSpeed * Time.deltaTime; + arrow.movedDistance += deltaDis; + + // 更新所有线条位置 + for (int i = 0; i < arrow.lineUnits.Count; i++) + { + float curDist = arrow.lineInitOffsets[i] + arrow.movedDistance; + Vector2 pos = GetPositionByDistance(arrow, curDist); + arrow.lineUnits[i].SetPosition(pos.x, pos.y, 0); + } + + // 更新箭头位置 + float arrowCurDist = arrow.arrowInitOffset + arrow.movedDistance; + Vector2 arrowPos = GetPositionByDistance(arrow, arrowCurDist); + arrow.arrowObj.SetPosition(arrowPos.x, arrowPos.y, 0); + + // 边界检测:以尾部线条为准(和原逻辑一致) + Vector2 tailPos = GetPositionByDistance(arrow, arrow.movedDistance); + if (CheckIsOutOfBounds(tailPos, arrow.finalMoveDir)) + { + // ========== 以下销毁逻辑和原代码保持一致 ========== + ReleaseArrowOccupied(arrow); + + foreach (var line in arrow.lineUnits) + { + if (line != null) + { + _viewContainer.RemoveChild(line); + line.Dispose(); + } + } + arrow.lineUnits.Clear(); + + if (arrow.arrowObj != null) + { + _viewContainer.RemoveChild(arrow.arrowObj); + arrow.arrowObj.Dispose(); + arrow.arrowObj = null; + } + + arrow.isMoving = false; + _remainArrowCount--; + + if (_remainArrowCount <= 0) + { + ShowResult(true); + } + else + { + DisappearLineGetReward(); + } + + yield break; + } + + yield return null; // 每帧执行一次,平滑移动 + } + } + + #region 移动工具方法 + /// 根据距离,计算沿轨迹的实际坐标 + private Vector2 GetPositionByDistance(ArrowConfig arrow, float distance) + { + int trackCount = arrow.totalTrack.Count; + const float segmentLen = 10f; // 轨迹点固定间距 + + // 距离在轨迹范围内:两点插值得到精确位置 + if (distance <= arrow.trackTotalLength) + { + float indexFloat = distance / segmentLen; + int index0 = Mathf.FloorToInt(indexFloat); + int index1 = Mathf.Min(index0 + 1, trackCount - 1); + float t = indexFloat - index0; + + Vector2 p0 = arrow.totalTrack[index0]; + Vector2 p1 = arrow.totalTrack[index1]; + return Vector2.Lerp(p0, p1, t); + } + // 距离超出轨迹:沿最终方向直线延伸 + else + { + float extraDis = distance - arrow.trackTotalLength; + Vector2 endPos = arrow.totalTrack[trackCount - 1]; + Vector2 dir = DirToVector2(arrow.finalMoveDir); + return endPos + dir * extraDis; + } + } + + /// 方向字符串转单位向量 + /// 方向字符串转单位向量(适配 FGUI 坐标系:y 轴向下) + private Vector2 DirToVector2(string dir) + { + return dir switch + { + "up" => new Vector2(0, -1), // FGUI 向上 = y 减小 + "down" => new Vector2(0, 1), // FGUI 向下 = y 增大 + "left" => new Vector2(-1, 0), + "right" => new Vector2(1, 0), + _ => new Vector2(0, -1) + }; + } + /// 统一获取箭头最终移动方向 + private string GetFinalMoveDir(ArrowConfig arrow) + { + if (arrow.path != null && arrow.path.Count > 0) + return arrow.path[arrow.path.Count - 1]; + if (!string.IsNullOrEmpty(arrow.defaultDir)) + return arrow.defaultDir; + return "up"; + } + + /// 统一边界检测 + private bool CheckIsOutOfBounds(Vector2 pos, string dir) + { + switch (dir) + { + case "right": return pos.x > gridRight + outOffset; + case "left": return pos.x < gridLeft - outOffset; + case "down": return pos.y > gridBottom + outOffset; + case "up": return pos.y < gridTop - outOffset; + default: return false; + } + } + #endregion + + /// + /// 消除每条线时概率获得奖励 + /// + private void DisappearLineGetReward() + { + + if (!GameHelper.IsGiftSwitch()) return; + + bool isGet = false; + + int money_rate = ConfigSystem.GetCommonConf().rewardrate; + var randomNum = UnityEngine.Random.Range(0, 100); + // Debug.Log($"[creat] money_rate------------ {randomNum}==={money_rate}"); + if (randomNum < money_rate) + { + isGet = true; + + // 显示大额奖励 + float[] cash_array = GameHelper.GetRewardValue(1); + var temp = new SuccessData(); + temp.IsWin = true; + temp.ch_number = cash_array[0]; + temp.rate = (int)cash_array[1]; + temp.IsLevelSuccess = false; + temp.IsH5Reward = false; + temp.boost_array = GameHelper.GetRewardBoost(1); + DOVirtual.DelayedCall(0.25f, () => + { + UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Open, temp); + }); + } + + + if (!isGet && Random.Range(0, 100) < ConfigSystem.GetCommonConf().Smallrewardsrate) + { + var rewardData = new RewardData(); + Vector2 fguiPosition = new Vector2(ui.samll_point.x, ui.samll_point.y); + var start = fguiPosition; + var end = GameHelper.GetUICenterPosition(ui.com_money.GetChild("text_gold")); + float[] cash_array = GameHelper.GetRewardValue(0); + Debug.Log($"小额奖励:{cash_array[0]}"); + var rewardSingleData = new RewardSingleData(102, (decimal)cash_array[0], RewardOrigin.AdTask) + { + startPosition = start, + endPosition = new Vector2(end.x - 135, end.y - 135) + }; + + rewardData.AddReward(rewardSingleData); + rewardData.displayType = RewardDisplayType.RewardFly | RewardDisplayType.ValueChange; + GameDispatcher.Instance.Dispatch(GameMsg.GetReward, rewardData); + } + } + + #endregion + + + #region 资源清理 + + /// 全局启动协程 + 自动记录,关闭界面时统一停止 + private Coroutine RunCoroutine(IEnumerator cor) + { + if (cor == null) return null; + Coroutine co = CrazyAsyKit.StartCoroutine(cor); + if (co != null) + { + _activeCoroutines.Add(co); + } + return co; + } + + private void ClearAllDynamicObj() + { + if (_levelConfig == null || _viewContainer == null) return; + + // 销毁网格圆点 + foreach (var dot in _gridDotList) + { + if (dot != null) + { + _viewContainer.RemoveChild(dot); + dot.Dispose(); + } + } + _gridDotList.Clear(); + + + foreach (var arrow in _levelConfig.arrows) + { + if (arrow.arrowObj != null) + { + _viewContainer.RemoveChild(arrow.arrowObj); + arrow.arrowObj.Dispose(); + arrow.arrowObj = null; + } + + foreach (var line in arrow.lineUnits) + { + _viewContainer.RemoveChild(line); + line.Dispose(); + } + arrow.lineUnits.Clear(); + } + } + #endregion + + #region 结算 + + /// + /// 弹出结算 + /// isSuccess: true=成功,false=失败 + /// + private void ShowResult(bool isSuccess) + { + // 暂停所有交互/移动(可选) + foreach (var arrow in _levelConfig.arrows) + { + arrow.isMoving = false; + } + + // uiCtrlDispatcher.Dispatch(UICtrlMsg.LevelSuccessUI_Open, isSuccess); + + if (isSuccess) + { + GameHelper.SetLevel(GameHelper.GetLevel() + 1); + + // DataMgr.ArrowChProgress.Value += 10; + //通关成功 + float[] cash_array = GameHelper.GetRewardValue(2); + + var temp = new SuccessData(); + temp.IsWin = true; + temp.ch_number = cash_array[0]; + temp.rate = (int)cash_array[1]; + temp.IsLevelSuccess = true; + temp.IsH5Reward = false; + temp.boost_array = GameHelper.GetRewardBoost(2); + DOVirtual.DelayedCall(0.2f, () => + { + UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Open, temp); + }); + } + else + { + //通关失败 + float[] cash_array = GameHelper.GetRewardValue(2); + + var temp = new SuccessData(); + temp.IsWin = false; + temp.ch_number = cash_array[0]; + temp.IsLevelSuccess = true; + temp.IsH5Reward = false; + temp.boost_array = GameHelper.GetRewardBoost(2); + DOVirtual.DelayedCall(0.2f, () => + { + UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Open, temp); + }); + } + } + + /// + /// 重新开始本局 + /// + /// true: 重生 false:重开一局或者下一局 + private void OnRestartGame(object a = null) + { + + Debug.Log($"[ArrowGameUI] 重新开始本局 a:{(bool)a}"); + if (a != null && (bool)a) + { + _heartCount = 3; + for (int i = _heartCount; i > 0; i--) + { + ui.HeartsPanel.GetChild($"xin_{i}").visible = true; + } + return; + } + + // 先清空当前所有动态物体 + ClearAllDynamicObj(); + + //获取下一关的配置数据 + LoadLevelConfig(); + // 重新走初始化流程 + InitGridBounds(); + InitGridOccupied(); + _heartCount = 3; + _collidedArrows.Clear(); + _remainArrowCount = _levelConfig.arrows.Count; + DataMgr.ArrowResultLevel.Value = 1; + + InitView(); + } + #endregion + + + } + + #region 配置解析 & 数据结构 + public static class JsonHelper + { + public static LevelConfig LoadLevel(string fileName) + { + string path = Path.Combine(Application.streamingAssetsPath, fileName); + return JsonUtility.FromJson(File.ReadAllText(path)); + } + } + + [System.Serializable] + public class LevelConfig + { + public int levelId; + public string levelName; + public int gridRows; + public int gridCols; + public int pointSpacing; + public List arrows; + } + + [System.Serializable] + public class ArrowConfig + { + public int id; + public int startPoint; + public List path; + [NonSerialized] public int endPoint; + [NonSerialized] public string color; + + [NonSerialized]public string defaultDir; + [NonSerialized]public List pathPointList; + [NonSerialized]public List lineUnits; + [NonSerialized]public GComponent arrowObj; + + [NonSerialized]public bool isMoving; + [NonSerialized]public List originalLinePos; + [NonSerialized]public Vector2 originalArrowPos; + + [NonSerialized]public List totalTrack; + [NonSerialized]public List lineTrackIndex; + [NonSerialized]public int arrowTrackIndex; + [NonSerialized]public string finalMoveDir; + + // ========== 距离驱动移动所需字段 ========== + [NonSerialized]public float movedDistance; // 当前整体累计移动距离 + [NonSerialized]public float trackTotalLength; // 整条轨迹的总像素长度 + [NonSerialized]public List lineInitOffsets; // 每个线条单元的初始距离偏移 + [NonSerialized]public float arrowInitOffset; // 箭头的初始距离偏移 + // ========== 运行时颜色缓存 ========== + [NonSerialized]public Color runtimeColor; + } + + [System.Serializable] + public class AllLevelRoot + { + public List levels; + } + #endregion + + +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/ArrowGame/ArrowGameUI.cs.meta b/Assets/Scripts/ModuleUI/ArrowGame/ArrowGameUI.cs.meta new file mode 100644 index 00000000..994a02ee --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowGame/ArrowGameUI.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 1a4af5e7d0ee45ed84096f4ea23331c2 +timeCreated: 1781178068 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/ArrowGame/ArrowGameUICtrl.cs b/Assets/Scripts/ModuleUI/ArrowGame/ArrowGameUICtrl.cs new file mode 100644 index 00000000..1f33af22 --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowGame/ArrowGameUICtrl.cs @@ -0,0 +1,91 @@ +namespace RedHotRoast +{ + public class ArrowGameUICtrl : BaseUICtrl + { + private ArrowGameUI ui; + private ArrowGameModel model; + + private uint openUIMsg = UICtrlMsg.ArrowGameUI_Open; + private uint closeUIMsg = UICtrlMsg.ArrowGameUI_Close; + + #region 生命周期 + protected override void OnInit() + { + //model = ModuleManager.Instance.GetModel(ModelConst.ArrowGameModel) as ArrowGameModel; + } + + protected override void OnDispose() + { + } + + public override void OpenUI(object args = null) + { + if (ui == null) + { + ui = new ArrowGameUI(this); + ui.Open(args); + } + } + + public override void CloseUI(object args = null) + { + if (ui != null && !ui.isClose) + { + ui.Close(); + } + ui = null; + } + #endregion + + #region 消息 + public override uint GetOpenUIMsg(string uiName) + { + return openUIMsg; + } + public override uint GetCloseUIMsg(string uiName) + { + return closeUIMsg; + } + + protected override void AddListener() + { + uiCtrlDispatcher.AddListener(openUIMsg, OpenUI); + uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI); + + GameDispatcher.Instance.AddListener(GameMsg.Update101, OnUpdate101); + GameDispatcher.Instance.AddListener(GameMsg.Update102, OnUpdate102); + } + protected override void RemoveListener() + { + uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI); + uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI); + + GameDispatcher.Instance.RemoveListener(GameMsg.Update101, OnUpdate101); + GameDispatcher.Instance.RemoveListener(GameMsg.Update102, OnUpdate102); + + } + + private void OnUpdate101(object obj) + { + ui?.OnUpdate101(obj); + } + + + private void OnUpdate102(object obj) + { + ui?.OnUpdate102(obj); + } + + + + protected override void AddServerListener() + { + + } + protected override void RemoveServerListener() + { + + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/ArrowGame/ArrowGameUICtrl.cs.meta b/Assets/Scripts/ModuleUI/ArrowGame/ArrowGameUICtrl.cs.meta new file mode 100644 index 00000000..68f6bf49 --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowGame/ArrowGameUICtrl.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 74f557b8baf9421bb8cc5c01adcd09b3 +timeCreated: 1781178068 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/MainTab.meta b/Assets/Scripts/ModuleUI/ArrowSetting.meta similarity index 77% rename from Assets/Scripts/ModuleUI/MainTab.meta rename to Assets/Scripts/ModuleUI/ArrowSetting.meta index f01d1194..8a3303c8 100644 --- a/Assets/Scripts/ModuleUI/MainTab.meta +++ b/Assets/Scripts/ModuleUI/ArrowSetting.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2d45a99956a41ec4c9d004c296c6257c +guid: 190b796dd1421454494f5be3c67c35d3 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/Scripts/ModuleUI/ArrowSetting/ArrowSettingCtrl.cs b/Assets/Scripts/ModuleUI/ArrowSetting/ArrowSettingCtrl.cs new file mode 100644 index 00000000..4c7f6c2a --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowSetting/ArrowSettingCtrl.cs @@ -0,0 +1,50 @@ + + +namespace RedHotRoast +{ + public class ArrowSettingCtrl : BaseCtrl + { + public static ArrowSettingCtrl Instance { get; private set; } + + private ArrowSettingModel model; + + #region 生命周期 + + protected override void OnInit() + { + Instance = this; + + } + + protected override void OnDispose() + { + Instance = null; + } + + #endregion + + #region 消息 + + protected override void AddListener() + { + + } + + protected override void RemoveListener() + { + + } + + protected override void AddServerListener() + { + + } + + protected override void RemoveServerListener() + { + + } + + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/ArrowSetting/ArrowSettingCtrl.cs.meta b/Assets/Scripts/ModuleUI/ArrowSetting/ArrowSettingCtrl.cs.meta new file mode 100644 index 00000000..7c452bb0 --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowSetting/ArrowSettingCtrl.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a719660d4b2e0254583b70941f0eede5 +timeCreated: 1676360266 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/ArrowSetting/ArrowSettingModel.cs b/Assets/Scripts/ModuleUI/ArrowSetting/ArrowSettingModel.cs new file mode 100644 index 00000000..9ccaae84 --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowSetting/ArrowSettingModel.cs @@ -0,0 +1,69 @@ + +namespace RedHotRoast +{ + public class ArrowSettingModel : BaseModel + { + public bool IsOpenMusic + { + get { return AudioManager.Instance.IsOpenBGM; } + set { AudioManager.Instance.IsOpenBGM = value; } + } + + public bool IsOpenEffect + { + get { return AudioManager.Instance.IsOpenEffect; } + set { AudioManager.Instance.IsOpenEffect = value; } + } + + #region 生命周期 + + + public string LangIdKey = "LangIdKey"; + protected override void OnInit() + { + } + + protected override void OnDispose() + { + } + + // protected override void OnReset() + // { + // } + + // #endregion + + // #region 读取数据 + + // protected override void OnReadData() + // { + // } + + // #endregion + + // #region 本地存储 + + + + // protected override void WriteLocalStorage() + // { + + // } + + #endregion + + #region 消息 + + protected override void AddListener() + { + + } + + protected override void RemoveListener() + { + + } + + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/ArrowSetting/ArrowSettingModel.cs.meta b/Assets/Scripts/ModuleUI/ArrowSetting/ArrowSettingModel.cs.meta new file mode 100644 index 00000000..fb2247f8 --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowSetting/ArrowSettingModel.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9bbfb75ed03e0fc43a081b175504f450 +timeCreated: 1676360266 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/ArrowSetting/ArrowSettingUI.cs b/Assets/Scripts/ModuleUI/ArrowSetting/ArrowSettingUI.cs new file mode 100644 index 00000000..6748fcca --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowSetting/ArrowSettingUI.cs @@ -0,0 +1,256 @@ +using IgnoreOPS; +using FairyGUI; +using FGUI.ZM_Setting_07; +using IgnoreOPS; +using UnityEngine; +using btn_head = FGUI.ZM_Common_01.btn_head; + +// using FGUI.G006_menu; + +namespace RedHotRoast +{ + public class ArrowSettingUI : BaseUI + { + private ArrowSettingUICtrl ctrl; + private ArrowSettingModel model; + private int _selectIndex = -1; + + private const int TotalItem = 8; + + private com_arrow_setting ui; + + public ArrowSettingUI(ArrowSettingUICtrl ctrl) : base(ctrl) + { + uiName = UIConst.ArrowSettingUI; + this.ctrl = ctrl; + } + + protected override void SetUIInfo(UIInfo uiInfo) + { + uiInfo.packageName = "ZM_Setting_07"; + uiInfo.assetName = "com_arrow_setting"; + uiInfo.layerType = UILayerType.Popup; + uiInfo.isNeedOpenAnim = false; + uiInfo.isNeedCloseAnim = false; + uiInfo.isNeedUIMask = true; + } + + #region 生命周期 + + protected override void OnInit() + { + model = moduleManager.GetModel(ModelConst.ArrowSettingModel) as ArrowSettingModel; + } + + protected override void OnClose() + { + // WebviewManager.ShezhiACT(true); + GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, true); + + } + + protected override void OnBind() + { + ui = baseUI as com_arrow_setting; + } + + protected override void OnOpenBefore(object args) + { + GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, false); + + // if (Screen.safeArea.y != 0) + // { + // ui.title.y += Screen.safeArea.y; + // } + // WebviewManager.ShezhiACT(false); + _selectIndex = DataMgr.PlayerAvatarId.Value; + + GetSliderValueByScale((float)args); + + InitView(); + } + + private void GetSliderValueByScale(float speed) + { + float validScale = Mathf.Clamp(speed, 1200f, 1700f); + float ratio = (validScale - 1200f) / (1700f - 1200f); + float sliderVal = ratio * 100f; + + ui.speed_slide.value = Mathf.Clamp(sliderVal, 0f, 100f); + } + + protected override void OnOpen(object args) + { + // CommonHelper.FadeIn(ui); + ui.show.Play(); + } + + protected override void OnHide() + { + } + + protected override void OnDisplay(object args) + { + } + + #endregion + + #region 消息 + + protected override void AddListener() + { + HallManager.Instance.AddChangeGiftSwitch(InitView); + } + + protected override void RemoveListener() + { + HallManager.Instance.RemoveChangeGiftSwitch(InitView); + } + + #endregion + + private void InitView() + { + SetVersion(); + SetUID(); + + var namStr = GameHelper.GetUserName(); + ui.edit_name.input.text = namStr; + + ui.btn_privacy.SetClick(() => { UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PrivacyUI_Open, 0); }); + ui.btn_terms.SetClick(() => { UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PrivacyUI_Open, 1); }); + ui.btn_official.SetClick(() => { OpenBrowser.OpenURL("http://captainsroll.com/"); }); + + ui.btn_us.SetClick(() => { GameHelper.OpenEmail(); }); + + ui.btn_revive.SetClick(() => + { + GameDispatcher.Instance.Dispatch(GameMsg.reset_game, false); + CtrlCloseUI(); + }); + + ui.level_text.SetVar("lv",GameHelper.GetLevel().ToString()).FlushVars(); + + ui.speed_slide.onChanged.Add(SetSlideValue); + + ui.btn_music.on_off.selectedIndex = + model.IsOpenMusic ? 0 : 1; + ui.btn_sound.on_off.selectedIndex = + GRoot.inst.soundVolume > 0 ? 0 : 1; + + ui.btn_music.SetClick(SetMusic); + ui.btn_sound.SetClick(SetSound); + + ui.btn_close.SetClick(() => + { + ui.hide.Play(UpdateUserInfo); + + }); + if (GameHelper.IsGiftSwitch()) + { + // ui.btn_restore.visible = false; + } + else + { + ui.btn_us.visible = true; + } + ui.btn_restore.SetClick(() => + { + // ApplePayManager.Instance.AppleRestore((success, message) => + // { + // if (success) + // { + // GameHelper.ShowTips("Restore Purchases Success!"); + // // SaveData.GetSaveObject().is_get_packreward = success; + // SaveData.GetSaveObject().have_slot = success; + // GameDispatcher.Instance.Dispatch(GameMsg.noads_refresh); + // } + // else + // { + // // Debug.Log("[barry] restore failed: " + success); + // GameHelper.ShowTips("There are no recoverable transactions"); + // } + // }); + }); + } + + private void SetSlideValue() + { + var sliderValue = (float)ui.speed_slide.value; + // 先把滑块值钳位在 0~100 内 + float val = Mathf.Clamp(sliderValue, 0f, 100f); + + // 线性映射:0→0.6,100→1.5 + float ratio = val / 100f; + float speed = 1200f + ratio * (1700f - 1200f); + + + speed = Mathf.Clamp(speed, 1200f, 1700f); + GameDispatcher.Instance.Dispatch(GameMsg.UpdateSpeed, speed); + } + + private void SetMusic() + { + model.IsOpenMusic = !model.IsOpenMusic; + + ui.btn_music.on_off.selectedIndex = model.IsOpenMusic + ? 0 + : 1; + } + + private void SetSound() + { + var sound = GRoot.inst.soundVolume; + sound = sound > 0 ? 0 : 1; + + GRoot.inst.soundVolume = sound; + PlayerPrefs.SetFloat("soundVolume", sound); + ui.btn_sound.on_off.selectedIndex = sound > 0 + ? 0 + : 1; + } + private void SetVersion() + { + // Debug.Log($"SetVersion====== {Application.version}"); + ui.text_version.SetVar("count", Application.version).FlushVars(); + } + + private void SetUID() + { + ui.text_uid.SetVar("UID", GameHelper.GetLoginModel().Uid.ToString()).FlushVars(); + } + + private void SetAvatar() + { + if (_selectIndex != -1 && _selectIndex != DataMgr.PlayerAvatarId.Value) + { + DataMgr.PlayerAvatarId.Value = _selectIndex; + } + } + + + private void UpdateUserInfo() + { + SaveName(); + + CtrlCloseUI(); + } + + private void SaveName() + { + var name = ui.edit_name.input.text; + + if (string.IsNullOrEmpty(name) || name.IsNullOrWhiteSpace()) + { + GameHelper.ShowTips("The input cannot be null", true); + return; + } + + if (name.Equals(DataMgr.PlayerName)) return; + + // GameHelper.ShowTips("Name changed successfully"); + DataMgr.PlayerName.Value = name; + } + + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/ArrowSetting/ArrowSettingUI.cs.meta b/Assets/Scripts/ModuleUI/ArrowSetting/ArrowSettingUI.cs.meta new file mode 100644 index 00000000..ac35df4d --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowSetting/ArrowSettingUI.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f70e08a1fa35f7e4296d5b0f093cba6e +timeCreated: 1676360265 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/ArrowSetting/ArrowSettingUICtrl.cs b/Assets/Scripts/ModuleUI/ArrowSetting/ArrowSettingUICtrl.cs new file mode 100644 index 00000000..198e63ce --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowSetting/ArrowSettingUICtrl.cs @@ -0,0 +1,82 @@ + +namespace RedHotRoast +{ + public class ArrowSettingUICtrl : BaseUICtrl + { + private ArrowSettingUI ui; + private ArrowSettingModel model; + + private uint openUIMsg = UICtrlMsg.ArrowSettingUI_Open; + private uint closeUIMsg = UICtrlMsg.ArrowSettingUI_Close; + + #region 生命周期 + + protected override void OnInit() + { + + } + + protected override void OnDispose() + { + } + + public override void OpenUI(object args = null) + { + if (ui == null) + { + ui = new ArrowSettingUI(this); + ui.Open(args); + + } + } + + public override void CloseUI(object args = null) + { + + if (ui != null && !ui.isClose) + { + ui.Close(); + } + ui = null; + + } + + #endregion + + #region 消息 + + public override uint GetOpenUIMsg(string uiName) + { + return openUIMsg; + } + + public override uint GetCloseUIMsg(string uiName) + { + return closeUIMsg; + } + + protected override void AddListener() + { + uiCtrlDispatcher.AddListener(openUIMsg, OpenUI); + uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI); + } + + protected override void RemoveListener() + { + uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI); + uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI); + } + + protected override void AddServerListener() + { + + } + + protected override void RemoveServerListener() + { + + } + + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/ArrowSetting/ArrowSettingUICtrl.cs.meta b/Assets/Scripts/ModuleUI/ArrowSetting/ArrowSettingUICtrl.cs.meta new file mode 100644 index 00000000..8e8312fb --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowSetting/ArrowSettingUICtrl.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c878a49cee89b2047b83b09db20d1c12 +timeCreated: 1676360266 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/ArrowTheme.meta b/Assets/Scripts/ModuleUI/ArrowTheme.meta new file mode 100644 index 00000000..bcf67f1e --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowTheme.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 397e677967c6452c9810742ba0f08b27 +timeCreated: 1783663847 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/ArrowTheme/ArrowThemeCtrl.cs b/Assets/Scripts/ModuleUI/ArrowTheme/ArrowThemeCtrl.cs new file mode 100644 index 00000000..916387ae --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowTheme/ArrowThemeCtrl.cs @@ -0,0 +1,41 @@ +namespace RedHotRoast +{ + public class ArrowThemeCtrl : BaseCtrl + { + public static ArrowThemeCtrl Instance { get; private set; } + + private ArrowThemeModel model; + + #region 生命周期 + protected override void OnInit() + { + Instance = this; + } + + protected override void OnDispose() + { + Instance = null; + } + #endregion + + #region 消息 + protected override void RemoveListener() + { + + } + + protected override void AddServerListener() + { + + } + protected override void AddListener() + { + + } + protected override void RemoveServerListener() + { + + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/ArrowTheme/ArrowThemeCtrl.cs.meta b/Assets/Scripts/ModuleUI/ArrowTheme/ArrowThemeCtrl.cs.meta new file mode 100644 index 00000000..c8639b9e --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowTheme/ArrowThemeCtrl.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e50273fc8b5c4fd28617651e820de81c +timeCreated: 1781573811 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/ArrowTheme/ArrowThemeModel.cs b/Assets/Scripts/ModuleUI/ArrowTheme/ArrowThemeModel.cs new file mode 100644 index 00000000..8bbe49de --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowTheme/ArrowThemeModel.cs @@ -0,0 +1,43 @@ +namespace RedHotRoast +{ + public class ArrowThemeModel : BaseModel + { + #region 生命周期 + protected override void OnInit() + { + } + + protected override void OnDispose() + { + } + + // protected override void OnReset() + // { + // } + // #endregion + + // #region 读取数据 + // protected override void OnReadData() + // { + // } + // #endregion + + // #region 本地存储 + // protected override void WriteLocalStorage() + // { + + // } + #endregion + + #region 消息 + protected override void AddListener() + { + + } + protected override void RemoveListener() + { + + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/ArrowTheme/ArrowThemeModel.cs.meta b/Assets/Scripts/ModuleUI/ArrowTheme/ArrowThemeModel.cs.meta new file mode 100644 index 00000000..098840d9 --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowTheme/ArrowThemeModel.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: cf2b28aa9d18433f9e27343cfcab577d +timeCreated: 1781573811 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/ArrowTheme/ArrowThemeUI.cs b/Assets/Scripts/ModuleUI/ArrowTheme/ArrowThemeUI.cs new file mode 100644 index 00000000..153017b0 --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowTheme/ArrowThemeUI.cs @@ -0,0 +1,149 @@ +using System; +using FGUI.Arrow_game; +using FGUI.Arrow_Theme; + +namespace RedHotRoast +{ + public class ArrowThemeUI : BaseUI + { + private ArrowThemeUICtrl ctrl; + private ArrowThemeModel model; + private com_theme ui; + + private Action closeCallback; + + + public ArrowThemeUI(ArrowThemeUICtrl ctrl) : base(ctrl) + { + uiName = UIConst.ArrowThemeUI; + this.ctrl = ctrl; + } + + protected override void SetUIInfo(UIInfo uiInfo) + { + uiInfo.packageName = "Arrow_Theme"; + uiInfo.assetName = "com_theme"; + uiInfo.layerType = UILayerType.Popup; + uiInfo.isNeedOpenAnim = true; + uiInfo.isNeedCloseAnim = true; + uiInfo.isNeedUIMask = true; + } + + #region 生命周期 + + protected override void OnInit() + { + //model = ModuleManager.Instance.GetModel(ModelConst.GameResultModel) as GameResultModel; + } + + protected override void OnClose() + { + GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, true); + + } + // + protected override void OnBind() + { + ui = baseUI as com_theme; + } + private SuccessData successData_; + + protected override void OnOpenBefore(object args) + { + GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, false); + + ui.btn_switch.state.selectedIndex = DataMgr.ArrowDarkTheme.Value; + SetBtnState(); + + ui.btn_dark.SetClick(() => { SetBtnClick(0); }); + // ui.btn_worm.SetClick(() => { SetBtnClick(1); }); + ui.btn_colours.SetClick(() => { SetBtnClick(2); }); + + + ui.btn_switch.SetClick(() => + { + if (DataMgr.ArrowDarkTheme.Value == 0) + { + DataMgr.ArrowDarkTheme.Value = 1; + } + else + { + DataMgr.ArrowDarkTheme.Value = 0; + } + + ui.btn_switch.state.selectedIndex = DataMgr.ArrowDarkTheme.Value; + + GameDispatcher.Instance.Dispatch(GameMsg.ThemeChange); + + }); + + ui.btn_close.SetClick(() => + { + CtrlCloseUI(); + }); + } + + private void SetBtnClick(int index) + { + DataMgr.ArrowTheme.Value = index; + SetBtnState(); + + GameDispatcher.Instance.Dispatch(GameMsg.ThemeChange); + } + + private void SetBtnState() + { + switch (DataMgr.ArrowTheme.Value) + { + case 0: + ((btn_green)ui.btn_dark).touchable = false; + ((btn_green)ui.btn_worm).touchable = true; + ((btn_green)ui.btn_colours).touchable = true; + ((btn_green)ui.btn_dark).state.selectedIndex = 0; + ((btn_green)ui.btn_worm).state.selectedIndex = 1; + ((btn_green)ui.btn_colours).state.selectedIndex = 1; + break; + case 1: + ((btn_green)ui.btn_dark).touchable = true; + ((btn_green)ui.btn_worm).touchable = false; + ((btn_green)ui.btn_colours).touchable = true; + ((btn_green)ui.btn_dark).state.selectedIndex = 1; + ((btn_green)ui.btn_worm).state.selectedIndex = 0; + ((btn_green)ui.btn_colours).state.selectedIndex = 1; + break; + case 2: + ((btn_green)ui.btn_dark).touchable = true; + ((btn_green)ui.btn_worm).touchable = true; + ((btn_green)ui.btn_colours).touchable = false; + ((btn_green)ui.btn_dark).state.selectedIndex = 1; + ((btn_green)ui.btn_worm).state.selectedIndex = 1; + ((btn_green)ui.btn_colours).state.selectedIndex = 0; + break; + } + } + + protected override void OnOpen(object args) + { + } + + protected override void OnHide() + { + } + + protected override void OnDisplay(object args) + { + } + #endregion + + #region 消息 + protected override void AddListener() + { + } + protected override void RemoveListener() + { + } + #endregion + private int time_count; + + } +} diff --git a/Assets/Scripts/ModuleUI/ArrowTheme/ArrowThemeUI.cs.meta b/Assets/Scripts/ModuleUI/ArrowTheme/ArrowThemeUI.cs.meta new file mode 100644 index 00000000..dcbcd4cc --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowTheme/ArrowThemeUI.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 730d3bd4697242e9a28a7f9b2933bcbb +timeCreated: 1781573811 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/ArrowTheme/ArrowThemeUICtrl.cs b/Assets/Scripts/ModuleUI/ArrowTheme/ArrowThemeUICtrl.cs new file mode 100644 index 00000000..e3300677 --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowTheme/ArrowThemeUICtrl.cs @@ -0,0 +1,87 @@ +using DG.Tweening; + +namespace RedHotRoast +{ + public class ArrowThemeUICtrl : BaseUICtrl + { + private ArrowThemeUI ui; + private ArrowThemeModel model; + + private uint openUIMsg = UICtrlMsg.ArrowThemeUI_Open; + private uint closeUIMsg = UICtrlMsg.ArrowThemeUI_Close; + + #region 生命周期 + protected override void OnInit() + { + //model = ModuleManager.Instance.GetModel(ModelConst.GameResultModel) as GameResultModel; + } + + protected override void OnDispose() + { + } + + private object m_data; + public override void OpenUI(object args = null) + { + if (ui == null) + { + ui = new ArrowThemeUI(this); + ui.Open(args); + } + else + { + m_data ??= args; + } + } + + public override void CloseUI(object args = null) + { + if (ui != null && !ui.isClose) + { + ui.Close(); + } + ui = null; + + if (m_data != null) + { + DOVirtual.DelayedCall(0.2f, () => + { + OpenUI(m_data); + m_data = null; + }); + } + } + #endregion + + #region 消息 + public override uint GetOpenUIMsg(string uiName) + { + return openUIMsg; + } + public override uint GetCloseUIMsg(string uiName) + { + return closeUIMsg; + } + + protected override void AddListener() + { + uiCtrlDispatcher.AddListener(openUIMsg, OpenUI); + uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI); + } + protected override void RemoveListener() + { + uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI); + uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI); + } + + protected override void AddServerListener() + { + + } + protected override void RemoveServerListener() + { + + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/ArrowTheme/ArrowThemeUICtrl.cs.meta b/Assets/Scripts/ModuleUI/ArrowTheme/ArrowThemeUICtrl.cs.meta new file mode 100644 index 00000000..3be5eb4e --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowTheme/ArrowThemeUICtrl.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f49d5a3813264e589acb43f743d50d24 +timeCreated: 1781573811 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/ArrowTips.meta b/Assets/Scripts/ModuleUI/ArrowTips.meta new file mode 100644 index 00000000..5e81bf1b --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowTips.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 62a730aa391641bf93ef2840dce2dcbc +timeCreated: 1783663847 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/ArrowTips/ArrowTipsCtrl.cs b/Assets/Scripts/ModuleUI/ArrowTips/ArrowTipsCtrl.cs new file mode 100644 index 00000000..d1510ee8 --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowTips/ArrowTipsCtrl.cs @@ -0,0 +1,19 @@ +namespace RedHotRoast +{ + public class ArrowTipsCtrl : BaseCtrl + { + public static ArrowTipsCtrl Instance { get; private set; } + + private ArrowTipsModel model; + + protected override void OnInit() + { + Instance = this; + } + + protected override void OnDispose() + { + Instance = null; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/ArrowTips/ArrowTipsCtrl.cs.meta b/Assets/Scripts/ModuleUI/ArrowTips/ArrowTipsCtrl.cs.meta new file mode 100644 index 00000000..aad48c99 --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowTips/ArrowTipsCtrl.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d070658caacf42a79ba55d6ac90d78a6 +timeCreated: 1781677288 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/MainTab/MainTabModel.cs b/Assets/Scripts/ModuleUI/ArrowTips/ArrowTipsModel.cs similarity index 78% rename from Assets/Scripts/ModuleUI/MainTab/MainTabModel.cs rename to Assets/Scripts/ModuleUI/ArrowTips/ArrowTipsModel.cs index 79a4aa79..e63c8842 100644 --- a/Assets/Scripts/ModuleUI/MainTab/MainTabModel.cs +++ b/Assets/Scripts/ModuleUI/ArrowTips/ArrowTipsModel.cs @@ -1,6 +1,6 @@ namespace RedHotRoast { - public class MainTabModel : BaseModel + public class ArrowTipsModel : BaseModel { protected override void OnInit() { diff --git a/Assets/Scripts/ModuleUI/ArrowTips/ArrowTipsModel.cs.meta b/Assets/Scripts/ModuleUI/ArrowTips/ArrowTipsModel.cs.meta new file mode 100644 index 00000000..a353e6c5 --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowTips/ArrowTipsModel.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4051b0d4995a4a1399d64e95c6c582f1 +timeCreated: 1781677288 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/ArrowTips/ArrowTipsUI.cs b/Assets/Scripts/ModuleUI/ArrowTips/ArrowTipsUI.cs new file mode 100644 index 00000000..01a02df8 --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowTips/ArrowTipsUI.cs @@ -0,0 +1,127 @@ +using System; +using FGUI.Arrow_game; +using IgnoreOPS; +using UnityEngine; + +namespace RedHotRoast +{ + + public class ArrowTipsUI : BaseUI + { + private ArrowTipsUICtrl ctrl; + private ArrowTipsModel model; + private com_tips ui; + + public ArrowTipsUI(ArrowTipsUICtrl ctrl) : base(ctrl) + { + uiName = UIConst.ArrowTipsUI; + this.ctrl = ctrl; + } + + protected override void SetUIInfo(UIInfo uiInfo) + { + uiInfo.packageName = "Arrow_game"; + uiInfo.assetName = "com_tips"; + uiInfo.layerType = UILayerType.Popup; + uiInfo.isNeedUIMask = true; + uiInfo.isNeedOpenAnim = true; + uiInfo.isNeedCloseAnim = true; + } + + protected override void OnInit() + { + } + + protected override void OnClose() + { + GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, true); + + CommonHelper.FadeOut(ui); + + HallManager.Instance.UpdateSecondEvent -= UpdateCd; + + } + + protected override void OnBind() + { + ui = baseUI as com_tips; + } + + private int state_; + protected override void OnOpenBefore(object args) + { + GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, false); + + if (args != null) + { + InitView((int)args); + state_ = (int)args + 5; + } + + HallManager.Instance.UpdateSecondEvent += UpdateCd; + UpdateCd(); + + if (GameHelper.IsGiftSwitch() && ConfigSystem.GetCommonConf().PiggyBankSwitch == 1) + { + ui.btn_watch.img_saveingpot.visible = true; + } + } + + protected override void OnOpen(object args) + { + CommonHelper.FadeIn(ui); + } + + protected override void AddListener() + { + } + + protected override void RemoveListener() + { + } + + private void InitView(int type) + { + int state = type; + Debug.Log($"tips state = {state} "); + // 0 提示 1 删除道具 + ui.state.selectedIndex = state; + + ui.btn_watch.SetClick(() => + { + string idStr = state == 1 ? "deletePop" : "HintPop"; + GameHelper.ShowVideoAd(idStr, isSuccess => + { + if (isSuccess) + { + Debug.Log($"isSuccess tips state = {state} "); + GameHelper.SetWatchCd(state_); + GameDispatcher.Instance.Dispatch(GameMsg.UseProps, state); + CtrlCloseUI(); + } + }); + }); + + ui.btn_close.SetClick(CtrlCloseUI); + } + + + private void UpdateCd() + { + var btnWatch = ui.btn_watch ; + // Debug.Log($"DataMgr.NewWatchCd.Value[state_ + 2]==={DataMgr.NewWatchCd.Value[state_ + 2]}"); + if (DataMgr.NewWatchCd.Value[state_] > Convert.ToInt32(GameHelper.GetNowTime())) + { + btnWatch.enabled = false; + btnWatch.can.selectedIndex = 1; + btnWatch.text.text = CommonHelper.TimeFormat(DataMgr.NewWatchCd.Value[state_] - Convert.ToInt32(GameHelper.GetNowTime()), CountDownType.Hour); + } + else + { + ui.btn_watch.enabled = true; + btnWatch.can.selectedIndex = 0; + btnWatch.text.text = "Use Item"; + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/ArrowTips/ArrowTipsUI.cs.meta b/Assets/Scripts/ModuleUI/ArrowTips/ArrowTipsUI.cs.meta new file mode 100644 index 00000000..89afbad2 --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowTips/ArrowTipsUI.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4737faa4124f48fabc5ef35ef2ff9f2f +timeCreated: 1781677288 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/MainTab/MainTabUICtrl.cs b/Assets/Scripts/ModuleUI/ArrowTips/ArrowTipsUICtrl.cs similarity index 75% rename from Assets/Scripts/ModuleUI/MainTab/MainTabUICtrl.cs rename to Assets/Scripts/ModuleUI/ArrowTips/ArrowTipsUICtrl.cs index 589948f7..6a8504e9 100644 --- a/Assets/Scripts/ModuleUI/MainTab/MainTabUICtrl.cs +++ b/Assets/Scripts/ModuleUI/ArrowTips/ArrowTipsUICtrl.cs @@ -1,14 +1,12 @@ namespace RedHotRoast { - public class MainTabUICtrl : BaseUICtrl + public class ArrowTipsUICtrl : BaseUICtrl { - private MainTabUI ui; - private MainTabModel model; + private ArrowTipsUI ui; + private ArrowTipsModel model; - private uint openUIMsg = UICtrlMsg.MainTabUI_Open; - private uint closeUIMsg = UICtrlMsg.MainTabUI_Close; - - #region 生命周期 + private uint openUIMsg = UICtrlMsg.ArrowTipsUI_Open; + private uint closeUIMsg = UICtrlMsg.ArrowTipsUI_Close; protected override void OnInit() { @@ -22,7 +20,7 @@ namespace RedHotRoast { if (ui == null) { - ui = new MainTabUI(this); + ui = new ArrowTipsUI(this); ui.Open(args); } } @@ -37,10 +35,6 @@ namespace RedHotRoast ui = null; } - #endregion - - #region 消息 - public override uint GetOpenUIMsg(string uiName) { return openUIMsg; @@ -62,9 +56,5 @@ namespace RedHotRoast uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI); uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI); } - - #endregion - - } } \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/ArrowTips/ArrowTipsUICtrl.cs.meta b/Assets/Scripts/ModuleUI/ArrowTips/ArrowTipsUICtrl.cs.meta new file mode 100644 index 00000000..cb465024 --- /dev/null +++ b/Assets/Scripts/ModuleUI/ArrowTips/ArrowTipsUICtrl.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 5e1a6be77c1c462a86ed773072d923d3 +timeCreated: 1781677288 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/GameAgain.meta b/Assets/Scripts/ModuleUI/GameAgain.meta new file mode 100644 index 00000000..8d53d9a5 --- /dev/null +++ b/Assets/Scripts/ModuleUI/GameAgain.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4cb018e70f844a67a2dd33d04abf6318 +timeCreated: 1783672661 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/GameAgain/GameAgainCtrl.cs b/Assets/Scripts/ModuleUI/GameAgain/GameAgainCtrl.cs new file mode 100644 index 00000000..535dffa4 --- /dev/null +++ b/Assets/Scripts/ModuleUI/GameAgain/GameAgainCtrl.cs @@ -0,0 +1,41 @@ +namespace RedHotRoast +{ + public class GameAgainCtrl : BaseCtrl + { + public static GameAgainCtrl Instance { get; private set; } + + private GameAgainModel model; + + #region 生命周期 + protected override void OnInit() + { + Instance = this; + } + + protected override void OnDispose() + { + Instance = null; + } + #endregion + + #region 消息 + protected override void RemoveListener() + { + + } + + protected override void AddServerListener() + { + + } + protected override void AddListener() + { + + } + protected override void RemoveServerListener() + { + + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/GameAgain/GameAgainCtrl.cs.meta b/Assets/Scripts/ModuleUI/GameAgain/GameAgainCtrl.cs.meta new file mode 100644 index 00000000..e32288da --- /dev/null +++ b/Assets/Scripts/ModuleUI/GameAgain/GameAgainCtrl.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: cee917424e204aeeb572fbd21d9a216a +timeCreated: 1781331027 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/GameAgain/GameAgainModel.cs b/Assets/Scripts/ModuleUI/GameAgain/GameAgainModel.cs new file mode 100644 index 00000000..8139adfe --- /dev/null +++ b/Assets/Scripts/ModuleUI/GameAgain/GameAgainModel.cs @@ -0,0 +1,43 @@ +namespace RedHotRoast +{ + public class GameAgainModel : BaseModel + { + #region 生命周期 + protected override void OnInit() + { + } + + protected override void OnDispose() + { + } + + // protected override void OnReset() + // { + // } + // #endregion + + // #region 读取数据 + // protected override void OnReadData() + // { + // } + // #endregion + + // #region 本地存储 + // protected override void WriteLocalStorage() + // { + + // } + #endregion + + #region 消息 + protected override void AddListener() + { + + } + protected override void RemoveListener() + { + + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/GameAgain/GameAgainModel.cs.meta b/Assets/Scripts/ModuleUI/GameAgain/GameAgainModel.cs.meta new file mode 100644 index 00000000..24c151f0 --- /dev/null +++ b/Assets/Scripts/ModuleUI/GameAgain/GameAgainModel.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: ba9f90a8f17245beb5fb93275fb663af +timeCreated: 1781331027 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/GameAgain/GameAgainUI.cs b/Assets/Scripts/ModuleUI/GameAgain/GameAgainUI.cs new file mode 100644 index 00000000..5afcfe15 --- /dev/null +++ b/Assets/Scripts/ModuleUI/GameAgain/GameAgainUI.cs @@ -0,0 +1,110 @@ +using System; +using DG.Tweening; +using FGUI.GameResult_08; +using UnityEngine; + +namespace RedHotRoast +{ + public class GameAgainUI : BaseUI + { + private GameAgainUICtrl ctrl; + private GameAgainModel model; + private com_arrow_end_again ui; + + private Action closeCallback; + + + public GameAgainUI(GameAgainUICtrl ctrl) : base(ctrl) + { + uiName = UIConst.GameAgainUI; + this.ctrl = ctrl; + } + + protected override void SetUIInfo(UIInfo uiInfo) + { + uiInfo.packageName = "GameResult_08"; + uiInfo.assetName = "com_arrow_end_again"; + uiInfo.layerType = UILayerType.Popup; + uiInfo.isNeedOpenAnim = true; + uiInfo.isNeedCloseAnim = true; + uiInfo.isNeedUIMask = true; + } + + #region 生命周期 + + protected override void OnInit() + { + //model = ModuleManager.Instance.GetModel(ModelConst.GameResultModel) as GameResultModel; + } + + protected override void OnClose() + { + + } + // + protected override void OnBind() + { + ui = baseUI as com_arrow_end_again; + } + private SuccessData successData_; + + protected override void OnOpenBefore(object args) + { + + ui.btn_revive.SetClick(() => + { + float[] cash_array = GameHelper.GetRewardValue(2); + + var temp = new SuccessData(); + temp.IsWin = false; + temp.ch_number = cash_array[0]; + temp.IsLevelSuccess = true; + temp.IsH5Reward = false; + temp.boost_array = GameHelper.GetRewardBoost(2); + DOVirtual.DelayedCall(0.1f, () => + { + UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Open, temp); + }); + CtrlCloseUI(); + }); + + ui.btn_restart.SetClick(() => + { + GameDispatcher.Instance.Dispatch(GameMsg.reset_game, false); + CtrlCloseUI(); + + }); + + ui.btn_back.SetClick(() => + { + + GameDispatcher.Instance.Dispatch(GameMsg.reset_game, false); + CtrlCloseUI(); + }); + } + + protected override void OnOpen(object args) + { + } + + protected override void OnHide() + { + } + + protected override void OnDisplay(object args) + { + } + #endregion + + #region 消息 + protected override void AddListener() + { + } + protected override void RemoveListener() + { + } + #endregion + private int time_count; + + } +} diff --git a/Assets/Scripts/ModuleUI/GameAgain/GameAgainUI.cs.meta b/Assets/Scripts/ModuleUI/GameAgain/GameAgainUI.cs.meta new file mode 100644 index 00000000..7c1b57c5 --- /dev/null +++ b/Assets/Scripts/ModuleUI/GameAgain/GameAgainUI.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: cb749d47d61d49feb70387124d69b69f +timeCreated: 1781331027 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/GameAgain/GameAgainUICtrl.cs b/Assets/Scripts/ModuleUI/GameAgain/GameAgainUICtrl.cs new file mode 100644 index 00000000..3dc1a5c9 --- /dev/null +++ b/Assets/Scripts/ModuleUI/GameAgain/GameAgainUICtrl.cs @@ -0,0 +1,87 @@ +using DG.Tweening; + +namespace RedHotRoast +{ + public class GameAgainUICtrl : BaseUICtrl + { + private GameAgainUI ui; + private GameAgainModel model; + + private uint openUIMsg = UICtrlMsg.GameAgainUI_Open; + private uint closeUIMsg = UICtrlMsg.GameAgainUI_Close; + + #region 生命周期 + protected override void OnInit() + { + //model = ModuleManager.Instance.GetModel(ModelConst.GameResultModel) as GameResultModel; + } + + protected override void OnDispose() + { + } + + private object m_data; + public override void OpenUI(object args = null) + { + if (ui == null) + { + ui = new GameAgainUI(this); + ui.Open(args); + } + else + { + m_data ??= args; + } + } + + public override void CloseUI(object args = null) + { + if (ui != null && !ui.isClose) + { + ui.Close(); + } + ui = null; + + if (m_data != null) + { + DOVirtual.DelayedCall(0.2f, () => + { + OpenUI(m_data); + m_data = null; + }); + } + } + #endregion + + #region 消息 + public override uint GetOpenUIMsg(string uiName) + { + return openUIMsg; + } + public override uint GetCloseUIMsg(string uiName) + { + return closeUIMsg; + } + + protected override void AddListener() + { + uiCtrlDispatcher.AddListener(openUIMsg, OpenUI); + uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI); + } + protected override void RemoveListener() + { + uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI); + uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI); + } + + protected override void AddServerListener() + { + + } + protected override void RemoveServerListener() + { + + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/GameAgain/GameAgainUICtrl.cs.meta b/Assets/Scripts/ModuleUI/GameAgain/GameAgainUICtrl.cs.meta new file mode 100644 index 00000000..77b40b4f --- /dev/null +++ b/Assets/Scripts/ModuleUI/GameAgain/GameAgainUICtrl.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b83d7c197169420da4fb3e79d330a74d +timeCreated: 1781331027 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/GoldReward/GoldRewardUI.cs b/Assets/Scripts/ModuleUI/GoldReward/GoldRewardUI.cs index 95ae9800..f8cfbe6f 100644 --- a/Assets/Scripts/ModuleUI/GoldReward/GoldRewardUI.cs +++ b/Assets/Scripts/ModuleUI/GoldReward/GoldRewardUI.cs @@ -1,152 +1,152 @@ -using UnityEngine; -using System.Collections.Generic; - -namespace RedHotRoast -{ - public class GoldRewardUI : BaseUI - { - private GoldRewardUICtrl ctrl; - private GoldRewardModel model; - private FGUI.ZM_AddCell_12.com_goldreward ui; - - public GoldRewardUI(GoldRewardUICtrl ctrl) : base(ctrl) - { - uiName = UIConst.GoldRewardUI; - this.ctrl = ctrl; - } - - protected override void SetUIInfo(UIInfo uiInfo) - { - uiInfo.packageName = "ZM_AddCell_12"; - uiInfo.assetName = "com_goldreward"; - uiInfo.layerType = UILayerType.Popup; - uiInfo.isNeedOpenAnim = false; - uiInfo.isNeedCloseAnim = false; - uiInfo.isNeedUIMask = true; - } - - #region 生命周期 - protected override void OnInit() - { - //model = ModuleManager.Instance.GetModel(ModelConst.GoldRewardModel) as GoldRewardModel; - } - - protected override void OnClose() - { - } - - protected override void OnBind() - { - ui = baseUI as FGUI.ZM_AddCell_12.com_goldreward; - } - - protected override void OnOpenBefore(object args) - { - turn_list = ConfigSystem.GetConfig(); - InitView(); - ui.btn_close.SetClick(() => - { - GameHelper.addInterAdnumber(); - CtrlCloseUI(); - }); - } - private List turn_list; - - protected override void OnOpen(object args) - { - } - - protected override void OnHide() - { - } - - protected override void OnDisplay(object args) - { - } - #endregion - - #region 消息 - protected override void AddListener() - { - - } - protected override void RemoveListener() - { - - } - #endregion - - //初始化页面逻辑 - private void InitView() - { - int weight_all = 0; - float max_gold = 0; - for (int i = 0; i < turn_list.Count; i++) - { - weight_all += turn_list[i].weight; - if (turn_list[i].quantity > max_gold) - { - max_gold = turn_list[i].quantity; - } - } - int random_ = Random.Range(0, weight_all); - int int_ = 0; - - - TurnOffRewards reward = null; - - for (int i = 0; i < turn_list.Count; i++) - { - int_ += turn_list[i].weight; - if (random_ < int_) - { - reward = turn_list[i]; - break; - } - } - if (reward == null) reward = turn_list[0]; - ui.text_goldnum.text = max_gold.ToString(); - // if (GameHelper.IsGiftSwitch() && ConfigSystem.GetConfig().PiggyBankSwitch == 1) - // { - // (ui.btn_receive.GetChild("img_saveingpot") as GImage).visible = true; - // } - ui.btn_receive.SetClick(() => - { - GameHelper.ShowVideoAd("TurnOffRewards", isSuccess => - { - if (isSuccess) - { - ui.btn_receive.SetClick(() => { }); - decimal gold = (decimal)reward.quantity; - var start = GameHelper.GetUICenterPosition(ui.text_goldnum); - var end = GameHelper.GetUICenterPosition(ui.end_point); - - var rewardData = new RewardData(); - var rewardSingleData = new RewardSingleData(101, gold, RewardOrigin.AdTask) - { - startPosition = start, - endPosition = new Vector2(end.x, end.y) - }; - rewardData.AddReward(rewardSingleData); - rewardData.displayType = RewardDisplayType.RewardFly | RewardDisplayType.ValueChange; - rewardData.AddCompleted((isScu) => - { - // DOVirtual.DelayedCall(0.5f, () => - // { - // var startNum = PreferencesMgr.Instance.Currency101 - gold; - // DOVirtual.Float((float)startNum, (float)GameHelper.GetGoldNumber(), 1f, - // value => { ui.btn_gold.GetChild("text_gold").text = GameHelper.Get101Str((decimal)value); }); - // }); - CtrlCloseUI(); - }); - - GameDispatcher.Instance.Dispatch(GameMsg.GetReward, rewardData); - - - } - }); - }); - - } - } -} +using UnityEngine; +using System.Collections.Generic; + +namespace RedHotRoast +{ + public class GoldRewardUI : BaseUI + { + private GoldRewardUICtrl ctrl; + private GoldRewardModel model; + private FGUI.ZM_AddCell_12.com_goldreward ui; + + public GoldRewardUI(GoldRewardUICtrl ctrl) : base(ctrl) + { + uiName = UIConst.GoldRewardUI; + this.ctrl = ctrl; + } + + protected override void SetUIInfo(UIInfo uiInfo) + { + uiInfo.packageName = "ZM_AddCell_12"; + uiInfo.assetName = "com_goldreward"; + uiInfo.layerType = UILayerType.Popup; + uiInfo.isNeedOpenAnim = false; + uiInfo.isNeedCloseAnim = false; + uiInfo.isNeedUIMask = true; + } + + #region 生命周期 + protected override void OnInit() + { + //model = ModuleManager.Instance.GetModel(ModelConst.GoldRewardModel) as GoldRewardModel; + } + + protected override void OnClose() + { + } + + protected override void OnBind() + { + ui = baseUI as FGUI.ZM_AddCell_12.com_goldreward; + } + + protected override void OnOpenBefore(object args) + { + turn_list = ConfigSystem.GetConfig(); + InitView(); + ui.btn_close.SetClick(() => + { + GameHelper.addInterAdnumber(); + CtrlCloseUI(); + }); + } + private List turn_list; + + protected override void OnOpen(object args) + { + } + + protected override void OnHide() + { + } + + protected override void OnDisplay(object args) + { + } + #endregion + + #region 消息 + protected override void AddListener() + { + + } + protected override void RemoveListener() + { + + } + #endregion + + //初始化页面逻辑 + private void InitView() + { + int weight_all = 0; + float max_gold = 0; + for (int i = 0; i < turn_list.Count; i++) + { + weight_all += turn_list[i].weight; + if (turn_list[i].quantity > max_gold) + { + max_gold = turn_list[i].quantity; + } + } + int random_ = Random.Range(0, weight_all); + int int_ = 0; + + + TurnOffRewards reward = null; + + for (int i = 0; i < turn_list.Count; i++) + { + int_ += turn_list[i].weight; + if (random_ < int_) + { + reward = turn_list[i]; + break; + } + } + if (reward == null) reward = turn_list[0]; + ui.text_goldnum.text = max_gold.ToString(); + // if (GameHelper.IsGiftSwitch() && ConfigSystem.GetCommonConf().PiggyBankSwitch == 1) + // { + // (ui.btn_receive.GetChild("img_saveingpot") as GImage).visible = true; + // } + ui.btn_receive.SetClick(() => + { + GameHelper.ShowVideoAd("TurnOffRewards", isSuccess => + { + if (isSuccess) + { + ui.btn_receive.SetClick(() => { }); + decimal gold = (decimal)reward.quantity; + var start = GameHelper.GetUICenterPosition(ui.text_goldnum); + var end = GameHelper.GetUICenterPosition(ui.end_point); + + var rewardData = new RewardData(); + var rewardSingleData = new RewardSingleData(101, gold, RewardOrigin.AdTask) + { + startPosition = start, + endPosition = new Vector2(end.x, end.y) + }; + rewardData.AddReward(rewardSingleData); + rewardData.displayType = RewardDisplayType.RewardFly | RewardDisplayType.ValueChange; + rewardData.AddCompleted((isScu) => + { + // DOVirtual.DelayedCall(0.5f, () => + // { + // var startNum = PreferencesMgr.Instance.Currency101 - gold; + // DOVirtual.Float((float)startNum, (float)GameHelper.GetGoldNumber(), 1f, + // value => { ui.btn_gold.GetChild("text_gold").text = GameHelper.Get101Str((decimal)value); }); + // }); + CtrlCloseUI(); + }); + + GameDispatcher.Instance.Dispatch(GameMsg.GetReward, rewardData); + + + } + }); + }); + + } + } +} diff --git a/Assets/Scripts/ModuleUI/H5/H5UI.cs b/Assets/Scripts/ModuleUI/H5/H5UI.cs index bce6ed1c..9758be33 100644 --- a/Assets/Scripts/ModuleUI/H5/H5UI.cs +++ b/Assets/Scripts/ModuleUI/H5/H5UI.cs @@ -113,13 +113,13 @@ namespace RedHotRoast private void OnClickFlyCash() { // PreferencesMgr.Instance.AdCashFlyShowTime = - // GameHelper.GetNowTime() + ConfigSystem.GetConfig().flyCD; + // GameHelper.GetNowTime() + ConfigSystem.GetCommonConf().flyCD; // var rewardData = new RewardData(); // var singleValue = // (decimal)Math.Round( - // UnityEngine.Random.Range(ConfigSystem.GetConfig().flyReward[0], - // ConfigSystem.GetConfig().flyReward[1]), 2); + // UnityEngine.Random.Range(ConfigSystem.GetCommonConf().flyReward[0], + // ConfigSystem.GetCommonConf().flyReward[1]), 2); // decimal rewardValue; @@ -172,7 +172,7 @@ namespace RedHotRoast private void OnClickIcon() { // //WebThroughUtil.WebThroughClick(H5WebThroughType.OnlineH5, ui.btn_icon); - // if (iconTime < ConfigSystem.GetConfig().ThroughRewardCD) + // if (iconTime < ConfigSystem.GetCommonConf().ThroughRewardCD) // { // return; // } diff --git a/Assets/Scripts/ModuleUI/Hall/HallUI.cs b/Assets/Scripts/ModuleUI/Hall/HallUI.cs index 5807d0f3..87422047 100644 --- a/Assets/Scripts/ModuleUI/Hall/HallUI.cs +++ b/Assets/Scripts/ModuleUI/Hall/HallUI.cs @@ -566,7 +566,7 @@ namespace RedHotRoast //ui.broadcast.visible = GameHelper.IsGiftSwitch(); ui.btn_pass.SetClick(OnClickPass); - // if (GameHelper.IsGiftSwitch() || (ConfigSystem.GetConfig().WVswitch == 1)) + // if (GameHelper.IsGiftSwitch() || (ConfigSystem.GetCommonConf().WVswitch == 1)) // { // ui.btn_h5.visible = false; // } @@ -578,10 +578,10 @@ namespace RedHotRoast ui.btn_head.SetClick(() => { UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PersonViewUI_Open); }); - if (HallManager.Instance.enterHallTimes == 1) - { - reCreatPur(); - } + // if (HallManager.Instance.enterHallTimes == 1) + // { + // reCreatPur(); + // } if (!GameHelper.IsGiftSwitch()) diff --git a/Assets/Scripts/ModuleUI/MainTab/MainTabUI.cs b/Assets/Scripts/ModuleUI/MainTab/MainTabUI.cs deleted file mode 100644 index 04d67023..00000000 --- a/Assets/Scripts/ModuleUI/MainTab/MainTabUI.cs +++ /dev/null @@ -1,246 +0,0 @@ -namespace RedHotRoast -{ - using System; - using System.Collections.Generic; - using FGUI.ZM_Tab_19; - using Newtonsoft.Json; - using UnityEngine; - - public class MainTabUI : BaseUI - { - private MainTabUICtrl ctrl; - private MainTabModel model; - private FGUI.ZM_Tab_19.com_main_tab ui; - - private Action closeCallBack; - - private static int mTabIndex = 1; - - public static int mLastIndex = 1; - - private bool exitH5Task; - - - - public MainTabUI(MainTabUICtrl ctrl) : base(ctrl) - { - uiName = UIConst.MainTabUI; - this.ctrl = ctrl; - } - - protected override void SetUIInfo(UIInfo uiInfo) - { - uiInfo.packageName = "ZM_Tab_19"; - uiInfo.assetName = "com_main_tab"; - uiInfo.layerType = UILayerType.Top; - uiInfo.isNeedOpenAnim = false; - uiInfo.isNeedCloseAnim = false; - uiInfo.isNeedUIMask = false; - } - - #region 生命周期 - - protected override void OnInit() - { - } - - protected override void OnClose() - { - CommonHelper.FadeOut(ui); - mLastIndex = 1; - mTabIndex = 1; - CloseAllTabView(); - } - - protected override void OnBind() - { - ui = baseUI as FGUI.ZM_Tab_19.com_main_tab; - } - - protected override void OnOpenBefore(object args) - { - if (args != null) - { - mTabIndex = (int)args; - } - - CheckH5Task(); - InitView(); - } - - private void CloseAllTabView() - { - uiCtrlDispatcher.Dispatch(UICtrlMsg.MenuUI_Close); - uiCtrlDispatcher.Dispatch(UICtrlMsg.MainUI_Close); - uiCtrlDispatcher.Dispatch(UICtrlMsg.MailUI_Close); - uiCtrlDispatcher.Dispatch(UICtrlMsg.SignInUI_Close); - - } - - protected override void OnOpen(object args) - { - CommonHelper.FadeIn(ui); - } - - #endregion - - #region 消息 - - protected override void AddListener() - { - // GameDispatcher.Instance.AddListener(GameMsg.MainTab, OnGameTab); - } - - protected override void RemoveListener() - { - // GameDispatcher.Instance.RemoveListener(GameMsg.MainTab, OnGameTab); - } - - #endregion - - private void CheckH5Task(object obj = null) - { - exitH5Task = false; - } - - private void InitView() - { - - ui.com_tab.btn_signin.SetClickDownEffect(0.8f, 1); - ui.com_tab.btn_main.SetClickDownEffect(0.8f, 1); - ui.com_tab.btn_mail.SetClickDownEffect(0.8f, 1); - ui.com_tab.btn_options.SetClickDownEffect(0.8f, 1); - - ui.com_tab.btn_signin.SetClick(OnClickSignInTab); - ui.com_tab.btn_main.SetClick(OnClickMainTab); - ui.com_tab.btn_mail.SetClick(OnClickMailTab); - ui.com_tab.btn_options.SetClick(OnClickSettingTab); - - OnGameTab(mTabIndex); - } - - private void OnClickSignInTab() - { - OnGameTab(1); - } - private void OnClickMainTab() - { - OnGameTab(2); - } - - private void OnClickMailTab() - { - OnGameTab(3); - } - - private void OnClickSettingTab() - { - OnGameTab(4); - } - - private void OnGameTab(object obj = null) - { - - if (obj != null) - { - mTabIndex = (int)obj; - } - - OnChangeTab(mTabIndex); - OnClickTab(mTabIndex); - } - - private void OnChangeTab(int tabIndex) - { - // ui.com_tab.cont_show.selectedIndex = tabIndex == 0 ? com_bottom.Show_mian : com_bottom.Show_show; - ui.com_tab.btn_signin.cont_tab.selectedIndex = tabIndex == 1 ? btn_sign.Tab_select : btn_sign.Tab_normal; - ui.com_tab.btn_main.cont_tab.selectedIndex = tabIndex == 2 ? btn_main.Tab_select : btn_main.Tab_normal; - ui.com_tab.btn_mail.cont_tab.selectedIndex = tabIndex == 3 ? btn_mail.Tab_select : btn_mail.Tab_normal; - ui.com_tab.btn_options.cont_tab.selectedIndex = tabIndex == 4 ? btn_options.Tab_select : btn_options.Tab_normal; - - - // ui.com_tab.btn_sign.cont_tab.selectedIndex = tabIndex == 2 ? btn_todos.Tab_select : btn_todos.Tab_normal; - // // ui.com_tab.btn_spin.cont_tab.selectedIndex = tabIndex == 1 ? btn_todos.Tab_select : btn_todos.Tab_normal; - // ui.com_tab.btn_setting.cont_tab.selectedIndex = tabIndex == 5 ? btn_todos.Tab_select : btn_todos.Tab_normal; - - } - - - public static void SwapElements(List list, int index1, int index2) - { - if (index1 >= 0 && index1 < list.Count && index2 >= 0 && index2 < list.Count) - { - (list[index2], list[index1]) = (list[index1], list[index2]); - } - else - { - throw new ArgumentOutOfRangeException("One or both of the provided indices are out of range."); - } - } - - - private void OnClickTab(int tabIndex) - { - if (mLastIndex == tabIndex) - { - return; - } - var isH5Tab = tabIndex == 5; - if (mLastIndex == 1) - { - uiCtrlDispatcher.Dispatch(UICtrlMsg.SignInUI_Close, false); - uiCtrlDispatcher.Dispatch(tabIndex == 2 ? UICtrlMsg.MainUI_Open : UICtrlMsg.MainUI_Close, tabIndex == 2 ? true : false); - uiCtrlDispatcher.Dispatch(tabIndex == 3 ? UICtrlMsg.MailUI_Open : UICtrlMsg.MailUI_Close, tabIndex == 3 ? true : false); - uiCtrlDispatcher.Dispatch(tabIndex == 4 ? UICtrlMsg.MenuUI_Open : UICtrlMsg.MenuUI_Close, tabIndex == 4 ? true : false); - - - } - else if (mLastIndex == 2) - { - uiCtrlDispatcher.Dispatch(UICtrlMsg.MainUI_Close, tabIndex < 2 ? true : false); - uiCtrlDispatcher.Dispatch(tabIndex == 1 ? UICtrlMsg.SignInUI_Open : UICtrlMsg.SignInUI_Close, false); - uiCtrlDispatcher.Dispatch(tabIndex == 3 ? UICtrlMsg.MailUI_Open : UICtrlMsg.MailUI_Close, tabIndex == 3 ? true : false); - uiCtrlDispatcher.Dispatch(tabIndex == 4 ? UICtrlMsg.MenuUI_Open : UICtrlMsg.MenuUI_Close, tabIndex == 4 ? true : false); - } - else if (mLastIndex == 3) - { - uiCtrlDispatcher.Dispatch(UICtrlMsg.MailUI_Close, tabIndex < 3 ? true : false); - uiCtrlDispatcher.Dispatch(tabIndex == 1 ? UICtrlMsg.SignInUI_Open : UICtrlMsg.SignInUI_Close, false); - uiCtrlDispatcher.Dispatch(tabIndex == 2 ? UICtrlMsg.MainUI_Open : UICtrlMsg.MainUI_Close, tabIndex == 2 ? false : true); - uiCtrlDispatcher.Dispatch(tabIndex == 4 ? UICtrlMsg.MenuUI_Open : UICtrlMsg.MenuUI_Close, tabIndex == 4 ? true : false); - } - else if (mLastIndex == 4) - { - uiCtrlDispatcher.Dispatch(UICtrlMsg.MenuUI_Close, true); - uiCtrlDispatcher.Dispatch(tabIndex == 1 ? UICtrlMsg.SignInUI_Open : UICtrlMsg.SignInUI_Close, false); - uiCtrlDispatcher.Dispatch(tabIndex == 2 ? UICtrlMsg.MainUI_Open : UICtrlMsg.MainUI_Close, tabIndex == 2 ? false : true); - uiCtrlDispatcher.Dispatch(tabIndex == 3 ? UICtrlMsg.MailUI_Open : UICtrlMsg.MailUI_Close, tabIndex == 3 ? false : true); - - } - - // uiCtrlDispatcher.Dispatch(tabIndex == 2 ? UICtrlMsg.MainUI_Open : UICtrlMsg.MainUI_Close, tabIndex < 2 ? true : false); - - // uiCtrlDispatcher.Dispatch(isH5Tab ? UICtrlMsg.BackgroundUI_Close : UICtrlMsg.BackgroundUI_Open); - - mLastIndex = tabIndex; - - - if (isH5Tab) - { - // AudioManager.Instance.StopBGM(); - } - else - { - //背景音乐 - AudioManager.Instance.PlayBGM("hall_bgm"); - } - - if (DataMgr.IsLastH5Tab.Value != isH5Tab) - { - DataMgr.IsLastH5Tab.Value = isH5Tab; - } - - - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/MakeupConfirm.meta b/Assets/Scripts/ModuleUI/MakeupConfirm.meta new file mode 100644 index 00000000..2b453d15 --- /dev/null +++ b/Assets/Scripts/ModuleUI/MakeupConfirm.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9b3645dfb7e849938977e4724592a9dc +timeCreated: 1783666276 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/MakeupConfirm/MakeupConfirmCtrl.cs b/Assets/Scripts/ModuleUI/MakeupConfirm/MakeupConfirmCtrl.cs new file mode 100644 index 00000000..b734e143 --- /dev/null +++ b/Assets/Scripts/ModuleUI/MakeupConfirm/MakeupConfirmCtrl.cs @@ -0,0 +1,19 @@ +namespace RedHotRoast +{ + public class MakeupConfirmCtrl : BaseCtrl + { + public static MakeupConfirmCtrl Instance { get; private set; } + + private MakeupConfirmModel model; + + protected override void OnInit() + { + Instance = this; + } + + protected override void OnDispose() + { + Instance = null; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/MakeupConfirm/MakeupConfirmCtrl.cs.meta b/Assets/Scripts/ModuleUI/MakeupConfirm/MakeupConfirmCtrl.cs.meta new file mode 100644 index 00000000..b7183a63 --- /dev/null +++ b/Assets/Scripts/ModuleUI/MakeupConfirm/MakeupConfirmCtrl.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 86c6a468456334464a52d60266162378 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/ModuleUI/MakeupConfirm/MakeupConfirmModel.cs b/Assets/Scripts/ModuleUI/MakeupConfirm/MakeupConfirmModel.cs new file mode 100644 index 00000000..946108c6 --- /dev/null +++ b/Assets/Scripts/ModuleUI/MakeupConfirm/MakeupConfirmModel.cs @@ -0,0 +1,13 @@ +namespace RedHotRoast +{ + public class MakeupConfirmModel : BaseModel + { + protected override void OnInit() + { + } + + protected override void OnDispose() + { + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/MakeupConfirm/MakeupConfirmModel.cs.meta b/Assets/Scripts/ModuleUI/MakeupConfirm/MakeupConfirmModel.cs.meta new file mode 100644 index 00000000..90ccf649 --- /dev/null +++ b/Assets/Scripts/ModuleUI/MakeupConfirm/MakeupConfirmModel.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1951296e9bf3242238f072254d2759b1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/ModuleUI/MakeupConfirm/MakeupConfirmUI.cs b/Assets/Scripts/ModuleUI/MakeupConfirm/MakeupConfirmUI.cs new file mode 100644 index 00000000..c6928873 --- /dev/null +++ b/Assets/Scripts/ModuleUI/MakeupConfirm/MakeupConfirmUI.cs @@ -0,0 +1,1251 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using DontConfuse; +using IgnoreOPS; +using IgnoreOPS; +using FairyGUI; +using FGUI.ZM_Common_01; +using FGUI.tixian; +using IgnoreOPS; +using Newtonsoft.Json; +using SGModule.Net; +using SGModule.NetKit; +using UnityEngine; +using Random = UnityEngine.Random; + +namespace RedHotRoast +{ + public class MakeupConfirmUI : BaseUI + { + private MakeupConfirmUICtrl ctrl; + private MakeupConfirmModel model; + private FGUI.tixian.com_confirm ui; + private MakeupTaskData makeupTaskData; + public int ad_cool_down = 120; + private long userUid; + + public MakeupConfirmUI(MakeupConfirmUICtrl ctrl) : base(ctrl) + { + uiName = UIConst.MakeupConfirmUI; + this.ctrl = ctrl; + } + + protected override void SetUIInfo(UIInfo uiInfo) + { + uiInfo.packageName = "tixian"; + uiInfo.assetName = "com_confirm"; + uiInfo.layerType = UILayerType.Popup; + uiInfo.isNeedOpenAnim = false; + uiInfo.isNeedCloseAnim = false; + uiInfo.isNeedUIMask = true; + } + + + protected override void OnInit() + { + + } + + protected override void OnClose() + { + + GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, true); + + HallManager.Instance.UpdateSecondEvent -= updateSpeedCD; + HallManager.Instance.UpdateSecondEvent -= Update; + HallManager.Instance.UpdateSecondEvent -= upTaskWatchAdsBtn; + HallManager.Instance.UpdateSecondEvent -= upLvWatchAdsBtn; + + GameHelper.showGameUI = true; + // WebviewManager.ShezhiACT(true); + WebviewManager.Instance.SetDarkThough(true); + + gameDispatcher.Dispatch(GameMsg.MakeUpConfirmUIClosed); + + if (UnityEngine.Random.Range(0, 100) < 50) + { + if (UnityEngine.Random.Range(0, 50) < 25) + { + // UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.FAQUI_Open); + } + else + { + UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.RecordViewUI_Open); + } + } + } + + protected override void OnBind() + { + ui = baseUI as com_confirm; + } + + protected override void OnOpenBefore(object args) + { + + GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, false); + + if (Screen.safeArea.y != 0) + {//刘海屏 + ui.group_.y += Screen.safeArea.y; + } + userUid = GameHelper.GetLoginModel().Uid; + ad_cool_down = ConfigSystem.GetCommonConf().WwalaccelerationCD; + DataMgr.MakeupTaskH5Time.Value = 999999999; + // DataMgr.Ticket.Value = 999999999; //zhushi + + // WebviewManager.ShezhiACT(false); + WebviewManager.Instance.SetDarkThough(false); + makeupTaskData = args as MakeupTaskData; + ch_index = makeupTaskData.tableId - 1; + ui.btn_earn.title = GameHelper.getDesByKey("ch_out_1"); + + + if (GameHelper.IsGiftSwitch() && ConfigSystem.GetCommonConf().PiggyBankSwitch == 1) + { + ui.btn_watch.GetChild("img_saveingpot").visible = true; + } + ui.btn_watch.SetClick(WatchBtnClick); + ui.btn_task_watch.SetClick(taskWatchBtnClick); + ui.btn_watchad.SetClick(LvWatchBtnClick); + + // AdRdManager.Instance.SetWatchAd(AdRdManager.MakeupAd, ui.btn_task_watch as btn_watchAd, () =>{}); + // AdRdManager.Instance.SetWatchAd(AdRdManager.MakeupLVAd, ui.btn_watchad as btn_watchAd, () =>{}); + // AdRdManager.Instance.Start(); + + HallManager.Instance.UpdateSecondEvent += updateSpeedCD; + HallManager.Instance.UpdateSecondEvent += Update; + + ui.text_chdate3.text = GameHelper.getDesByKey("makeup_11"); + + updateSpeedCD(); + InitView(); + initButtom(); + } + + protected override void OnOpen(object args) + { + } + + protected override void OnHide() + { + } + + protected override void OnDisplay(object args) + { + } + + + + + + protected override void AddListener() + { + + } + + protected override void RemoveListener() + { + } + + private void Update() + { + if (ui.cont_state.selectedIndex == 5) + { + Debug.Log("???????kkkkkkkkk"); + ui.text_leveltime.text = CommonHelper.TimeFormat((int)makeupTaskData.ch_time - Convert.ToInt32(GameHelper.GetNowTime()), CountDownType.Hour); + if ((GameHelper.isRDExchangeMode() && DataMgr.ExchangeProcessMode.Value == 1) || (!GameHelper.isRDExchangeMode() && DataMgr.CHProcessMode.Value == 1)) + { + ui.text_leveltime.visible = ui.text_cashneedlv.visible = false; + ui.level_state.selectedIndex = 0; + } + else + { + if (makeupTaskData.ch_time > GameHelper.GetNowTime()) + { + ui.level_state.selectedIndex = 0; + } + else + { + if (ConfigSystem.GetCommonConf().ExpiryUnlock == 0) + { + makeupTaskData.ch_time = GameHelper.GetNowTime() + ConfigSystem.GetCommonConf().BalanceExpired * 3600; + DataMgr.MakeupTaskHistory.Save(); + } + else ui.level_state.selectedIndex = 1; + } + } + + } + } + + private void InitView(object a = null) + { + if (makeupTaskData == null) + { + return; + } + if (DataMgr.MakeupTaskHistory.Value.Count > 1) + { + ui.group_.visible = true; + } + else + { + if (DataMgr.MakeupTaskHistory.Value[0].status >= MakeupTaskStatus.Level) ui.group_.visible = true; + } + + initTop(); + ui.btn_close.SetClick(CtrlCloseUI); + + if ((GameHelper.isRDExchangeMode() && DataMgr.ExchangeProcessMode.Value == 1) || (!GameHelper.isRDExchangeMode() && DataMgr.CHProcessMode.Value == 1)) + { + if (makeupTaskData.status == MakeupTaskStatus.Level) + { + Debug.Log("00000000000000000003"); + ui.cont_state.selectedIndex = 5; + Update(); + var vo = MakeupModel.GetData(makeupTaskData.tableId); + + string str = string.Format(GameHelper.getDesByKey("makeup_6"), vo.levels_need); + ui.text_chneedlv.text = str; + ui.lab_lv_need_des.SetVar("num", ConfigSystem.GetCommonConf().ExpiryUnlock.ToString()).FlushVars(); + Debug.Log(ConfigSystem.GetCommonConf().ExpiryUnlock); + str = string.Format("Owner ADs: {0}/{1}", makeupTaskData.LvVideoCount, ConfigSystem.GetCommonConf().ExpiryUnlock); + ui.lab_ads.text = str; + ui.text_nowch.text = GameHelper.Get102Str(DataMgr.Ticket.Value); + ui.text_ch_title.text = "Level " + vo.levels_need; + if (GameHelper.IsGiftSwitch() && ConfigSystem.GetCommonConf().PiggyBankSwitch == 1) + { + (ui.btn_watchad.GetChild("img_saveingpot") as GImage).visible = true; + } + if (GameHelper.GetLevel() <= vo.levels_need) + { + ui.btn_check_level.title = "Go"; + if (UIManager.Instance.IsExistUI(UIConst.RainPlayUI)) + { + ui.btn_check_level.SetClick(() => + { + CtrlCloseUI(); + }); + } + else + { + ui.btn_check_level.SetClick(() => + { + //跳转游戏,本来就在游戏中 + // GameDispatcher.Instance.Dispatch(GameMsg.OpenGame); + CtrlCloseUI(); + }); + } + + } + else + { + ui.btn_check_level.title = GameHelper.getDesByKey("ch_out_2"); + ui.btn_check_level.SetClick(() => + { + // PlayerPrefs.SetInt("ch_lv", vo.id); + makeupTaskData.SetStatus(MakeupTaskStatus.None); + DataMgr.MakeupTaskHistory.Save(); + InitView(); + }); + } + } + else if (makeupTaskData.status == MakeupTaskStatus.None) + { + Debug.Log("0000000000000000000"); + OnConfirm(); + } + else if (string.IsNullOrEmpty(makeupTaskData.ExchangeAccount) && !GameHelper.isRDExchangeMode()) + { + Debug.Log("00000000000000000001"); + OnEnter(); + } + else if (makeupTaskData.status == MakeupTaskStatus.Task) + { + Debug.Log("00000000000000000002"); + OnTask(); + } + + else if (makeupTaskData.status == MakeupTaskStatus.Inline) + { + OnInline(); + } + else if (makeupTaskData.status == MakeupTaskStatus.editAccount) + { + Debug.Log("00000000000000000004"); + OnEnter(); + } + else if (makeupTaskData.status == MakeupTaskStatus.ticket) + { + onTicket(); + } + else if (makeupTaskData.status == MakeupTaskStatus.code) + { + onCode(); + } + + } + else + { + if (makeupTaskData.status == MakeupTaskStatus.None) + { + Debug.Log("0000000000000000000"); + OnConfirm(); + } + else if (string.IsNullOrEmpty(makeupTaskData.ExchangeAccount) && !GameHelper.isRDExchangeMode()) + { + Debug.Log("00000000000000000001"); + OnEnter(); + } + else if (makeupTaskData.status == MakeupTaskStatus.Task) + { + Debug.Log("00000000000000000002"); + OnTask(); + } + else if (makeupTaskData.status == MakeupTaskStatus.Level) + { + Debug.Log("00000000000000000003"); + ui.cont_state.selectedIndex = 5; + Update(); + var vo = MakeupModel.GetData(makeupTaskData.tableId); + + string str = string.Format(GameHelper.getDesByKey("makeup_6"), vo.levels_need); + ui.text_chneedlv.text = str; + ui.lab_lv_need_des.SetVar("num", ConfigSystem.GetCommonConf().ExpiryUnlock.ToString()).FlushVars(); + Debug.Log(ConfigSystem.GetCommonConf().ExpiryUnlock); + str = string.Format("Owner ADs: {0}/{1}", makeupTaskData.LvVideoCount, ConfigSystem.GetCommonConf().ExpiryUnlock); + ui.lab_ads.text = str; + ui.text_nowch.text = GameHelper.Get102Str(DataMgr.Ticket.Value); + ui.text_ch_title.text = "Level " + vo.levels_need; + if (GameHelper.IsGiftSwitch() && ConfigSystem.GetCommonConf().PiggyBankSwitch == 1) + { + (ui.btn_watchad.GetChild("img_saveingpot") as GImage).visible = true; + } + + if (GameHelper.GetLevel() <= vo.levels_need) + { + ui.btn_check_level.title = "Go"; + if (UIManager.Instance.IsExistUI(UIConst.RainPlayUI)) + { + ui.btn_check_level.SetClick(() => + { + CtrlCloseUI(); + }); + } + else + { + ui.btn_check_level.SetClick(() => + { + GameDispatcher.Instance.Dispatch(GameMsg.OpenGame); + CtrlCloseUI(); + }); + } + + } + else + { + ui.btn_check_level.title = GameHelper.getDesByKey("ch_out_2"); + ui.btn_check_level.SetClick(() => + { + // PlayerPrefs.SetInt("ch_lv", vo.id); + // SaveData.GetSaveObject().chout_lv = vo.id; + // SaveData.SaveDataFunc(); + GameHelper.ShowLoading(1, 2, () => + { + ConsumeSystem.Consume(vo.item, vo.item_need, isSuccess => + { + makeupTaskData.SetStatus(MakeupTaskStatus.Inline); + makeupTaskData.inlineInitNum = + CommonHelper.RandomRange(ConfigSystem.GetCommonConf().inlineInitNum[0], + ConfigSystem.GetCommonConf().inlineInitNum[1]); + makeupTaskData.inlineNum = CommonHelper.RandomRange( + ConfigSystem.GetCommonConf().inlineInitNum[0], + makeupTaskData.inlineInitNum); + makeupTaskData.order_time = GameHelper.GetNowTime(); + DataMgr.MakeupTaskHistory.Save(); + GameDispatcher.Instance.Dispatch(GameMsg.Update102); + //OnInline(); + // Debug.Log(JsonConvert.SerializeObject(vo)); + if (vo.id == 1) + { + TrackKit.SendEvent(ADEventTrack.WithdrawEvent,ADEventTrack.Property.WithdrawCash, 1); + + } + else if (vo.id == 2) + { + TrackKit.SendEvent(ADEventTrack.WithdrawEvent,ADEventTrack.Property.WithdrawCash, 2); + } + else if (vo.id == 3) + { + TrackKit.SendEvent(ADEventTrack.WithdrawEvent,ADEventTrack.Property.WithdrawCash, 3); + } + if (vo.id != 3) + { + ch_index++; + } + InitView(); + if (vo.id == 3) + { + // PlayerPrefs.SetInt("ch_lv", 2); + // SaveData.GetSaveObject().chout_lv = 2; + // SaveData.SaveDataFunc(); + makeupTaskData = DataMgr.MakeupTaskHistory.Value.Last(); + } + + }); + }); + InitView(); + }); + } + } + else if (makeupTaskData.status == MakeupTaskStatus.Inline) + { + OnInline(); + } + else if (makeupTaskData.status == MakeupTaskStatus.editAccount) + { + Debug.Log("00000000000000000004"); + OnEnter(); + } + else if (makeupTaskData.status == MakeupTaskStatus.ticket) + { + onTicket(); + } + else if (makeupTaskData.status == MakeupTaskStatus.code) + { + onCode(); + } + } + + + } + private int now_selectindex = 0; + private int ch_index = 0; + void initTop() + { + Debug.Log(JsonConvert.SerializeObject(DataMgr.MakeupTaskHistory.Value)); + List btn_list = new List() { ui.com_chlevel.btn_0, ui.com_chlevel.btn_1, ui.com_chlevel.btn_2 }; + + List makeup_list = ConfigSystem.GetConfig(); + now_selectindex = makeupTaskData.tableId - 1; + for (int i = 0; i < btn_list.Count; i++) + { + btn_list[i].text_level0.text = "Level " + makeup_list[i].levels_need; + btn_list[i].text_level1.text = "Level " + makeup_list[i].levels_need; + btn_list[i].text_level2.text = "Level " + makeup_list[i].levels_need; + if (i < ch_index) + { + btn_list[i].img_check.visible = true; + // btn_list[i].text_level0.y = 4; + // btn_list[i].text_level1.y = 4; + + } + else + { + btn_list[i].img_check.visible = false; + // btn_list[i].text_level0.y = 38; + // btn_list[i].text_level1.y = 38; + } + + if (i == now_selectindex) + { + btn_list[i].btn_state.selectedIndex = 1; + } + else if (i > ch_index) + { + btn_list[i].btn_state.selectedIndex = 2; + int _temp_index = i; + btn_list[i].SetClick(() => + { + GameHelper.ShowTips("Complete level " + makeup_list[_temp_index].levels_need + " to unlock."); + }); + } + else + { + btn_list[i].btn_state.selectedIndex = 0; + int index = i; + btn_list[i].SetClick(() => + { + for (int i = DataMgr.MakeupTaskHistory.Value.Count - 1; i >= 0; i--) + { + if (DataMgr.MakeupTaskHistory.Value[i].tableId == index + 1) + { + makeupTaskData = DataMgr.MakeupTaskHistory.Value[i]; + now_selectindex = index; + break; + } + } + + InitView(); + }); + } + } + + } + void initButtom() + { + int day = DateTime.Now.Day; + int hour = DateTime.Now.Hour; + Debug.Log(day); + if (day != SaveData.GetSaveObject().login_day) + { + SaveData.GetSaveObject().login_day = day; + SaveData.GetSaveObject().login_hour = 0; + // public int ch_people; + // public float ch_people_1; + // public float ch_people_2; + SaveData.GetSaveObject().ch_people = UnityEngine.Random.Range(500, 800); + SaveData.GetSaveObject().ch_people_1 = UnityEngine.Random.Range(20, 30); + SaveData.GetSaveObject().ch_people_2 = UnityEngine.Random.Range(3, 6) * 100; + SaveData.SaveDataFunc(); + } + if (hour != SaveData.GetSaveObject().login_hour) + { + + SaveData.GetSaveObject().ch_people += ((hour - SaveData.GetSaveObject().login_hour) / 3) * UnityEngine.Random.Range(8, 10); + SaveData.GetSaveObject().ch_people_1 += ((hour - SaveData.GetSaveObject().login_hour) / 3) * UnityEngine.Random.Range(10, 15); + SaveData.GetSaveObject().ch_people_2 += ((hour - SaveData.GetSaveObject().login_hour) / 3) * UnityEngine.Random.Range(1, 3) * 100; + if (hour - SaveData.GetSaveObject().login_hour >= 3) SaveData.GetSaveObject().login_hour = hour; + SaveData.SaveDataFunc(); + } + + + + ui.text_number0.text = SaveData.GetSaveObject().ch_people.ToString(); + ui.text_number1.text = SaveData.GetSaveObject().ch_people_1.ToString(); + ui.text_number2.text = GameHelper.Get102Str((decimal)SaveData.GetSaveObject().ch_people_2); + ui.text_chdate.text = string.Format(ui.text_chdate.text, DateTime.Now.Year + "." + DateTime.Now.Month + "." + DateTime.Now.Day); + + } + + private void OnEnter() + { + GTextInput enter_input = null; + enter_input = ui.com_info.enter_email; + + ui.cont_state.selectedIndex = 0; + ui.text_title.text = GameHelper.getDesByKey("makeup_9"); + ui.text_smaill_title.text = GameHelper.getDesByKey("makeup_10"); + ui.btn_tab.SetClick(() => + { + var account = enter_input.text.Replace(" ", ""); + if (account == null || account == "") + { + GameHelper.ShowTips("Please enter the correct account information", true); + return; + } + + if (!GameHelper.CheckAccountValidly(account)) + { + GameHelper.ShowTips("Please enter the correct account information", true); + return; + } + + var fname = ui.com_fname.enter_fname.text.Replace(" ", ""); + if (!GameHelper.CheckNameValidly(fname)) + { + GameHelper.ShowTips("Please enter the correct account information", true); + return; + } + + var lname = ui.com_lname.enter_lname.text.Replace(" ", ""); + if (!GameHelper.CheckNameValidly(lname) && !AppConst.isPt()) + { + GameHelper.ShowTips("Please enter the correct account information", true); + return; + } + + makeupTaskData.ExchangeAccount = account; + makeupTaskData.ExchangeName = $"{fname} {lname}"; + makeupTaskData.short_name = fname; + makeupTaskData.long_name = lname; + if (GameHelper.isRDExchangeMode()) + { + makeupTaskData.SetStatus(MakeupTaskStatus.ticket); + DataMgr.MakeupTaskHistory.Save(); + InitView(); + } + else + { + DataMgr.MakeupTaskHistory.Save(); + showPaypal(); + } + }); + + } + + void showPaypal() + { + ui.cont_state.selectedIndex = 4; + + if (makeupTaskData == null) + { + return; + } + + + ui.com_pay.text_name.text = makeupTaskData.ExchangeName; + ui.com_pay.text_email.text = makeupTaskData.ExchangeAccount; + var avatarId = DataMgr.PlayerAvatarId.Value; + TextureHelper.SetAvatarToLoader(avatarId, ui.com_pay.head.GetChild("load_avatar") as GLoader); + + ui.com_pay.btn_change.SetClick(() => + { + makeupTaskData.ExchangeName = null; + makeupTaskData.ExchangeAccount = null; + ui.cont_state.selectedIndex = 0; + + // uiCtrlDispatcher.Dispatch(UICtrlMsg.MakeupConfirmUI_Open, makeupTaskData); + // CtrlCloseUI(); + }); + + //ui.btn_confirm.touchable = false; + //GameHelper.PlayFGUIFx(ui.fx_in, true, () => { ui.btn_confirm.touchable = true; }); + + ui.btn_confirm.SetClick(() => + { + NetApi.PayOutUserInfo(makeupTaskData.ExchangeAccount, + makeupTaskData.short_name, makeupTaskData.long_name, (isSuccess, obj) => + { + if (isSuccess) + { + } + }); + + TrackKit.SendEvent(ADEventTrack.WithdrawEvent,ADEventTrack.Property.WithdrawMessage); + makeupTaskData.SetStatus(MakeupTaskStatus.Task); + InitView(); + // uiCtrlDispatcher.Dispatch(UICtrlMsg.MakeupConfirmUI_Open, makeupTaskData); + //CtrlCloseUI(); + }); + } + + private void OnConfirm() + { + ui.cont_state.selectedIndex = 1; + + var vo = MakeupModel.GetData(makeupTaskData.tableId); + if (vo == null) + { + return; + } + + ui.text_condi1.text = GameHelper.getChString(vo.item_need); + ui.pb_condi1.max = vo.item_need; + Debug.Log($"DataMgr.Ticket.Value==============={DataMgr.Ticket.Value}"); + ui.text_ch_number.text = GameHelper.getChString(DataMgr.Ticket.Value); + var curValue = Math.Min(DataMgr.Ticket.Value, vo.item_need); + ui.pb_condi1.value = (double)curValue; + var textTitle = ui.pb_condi1.GetChild("title"); + if (textTitle != null) + { + textTitle.text = GameHelper.getChString(curValue) + "/" + GameHelper.getChString(vo.item_need); + } + + var taskTime = (int)((float)vo.task_need / 60 * 100) * 0.01F; + var completeTaskTime = (int)((float)DataMgr.MakeupTaskH5Time.Value / 60 * 100) * 0.01F; + var completeTaskValue = Math.Min(completeTaskTime, taskTime); + + if (DataMgr.Ticket.Value >= vo.item_need && + completeTaskTime >= taskTime) + { + ui.cont_confirm.selectedIndex = 0; + + ui.btn_earn.SetClick(() => + { + AudioManager.Instance.PlayDynamicEffect(AudioConst.MakeupDone); + makeupTaskData.SetStatus(MakeupTaskStatus.Task); + DataMgr.MakeupTaskHistory.Save(); + DataMgr.Ticket.Value -= vo.item_need; + GameDispatcher.Instance.Dispatch(GameMsg.Update102); + // OnTask(); + InitView(); + }); + } + else + { + ui.cont_confirm.selectedIndex = 1; + (ui.btn_earn as btn_get).state.selectedIndex = 1; + ui.btn_earn.SetClick(() => + { + // AudioManager.Instance.PlayDynamicEffect(AudioConst.MakeupDone); + // UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.H5UI_Open); + // //GameDispatcher.Instance.Dispatch(GameMsg.MainTab, 1); + + CtrlCloseUI(); + // + }); + } + } + + private void OnTask() + { + var vo = MakeupModel.GetData(makeupTaskData.tableId); + if (vo == null) + { + return; + } + + ui.cont_state.selectedIndex = 2; + ui.com_task.text_orderid.text = makeupTaskData.orderID; + ui.com_task.text_task_title.SetVar("ad", vo.ad_need.ToString()).FlushVars(); + ui.com_task.text_ads.text = $"{makeupTaskData.videoCount}/{vo.ad_need}"; + ui.com_task.text_payer.SetVar("amt", "$" + makeupTaskData.GetAmountStr()).FlushVars(); + if (GameHelper.isRDExchangeMode()) + { + ui.com_task.text_task.text = GameHelper.getDesByKey("makeup_12"); + } + else + { + string str = string.Format(GameHelper.getDesByKey("makeup_12"), makeupTaskData.GetAmountStr()); + ui.com_task.text_task.text = str; + } + if (makeupTaskData.videoCount >= vo.ad_need) + { + ui.com_task.cont_process.selectedIndex = 1; + ui.cont_confirm.selectedIndex = 0; + + } + else + { + ui.com_task.cont_process.selectedIndex = 0; + ui.cont_confirm.selectedIndex = 1; + } + if (makeupTaskData.videoCount >= vo.ad_need) + { + (ui.btn_chout as btn_get).state.selectedIndex = 0; + ui.btn_chout.SetClick(() => + { + if (makeupTaskData.videoCount >= vo.ad_need) + { + if ((GameHelper.isRDExchangeMode() && DataMgr.ExchangeProcessMode.Value == 1) || (!GameHelper.isRDExchangeMode() && DataMgr.CHProcessMode.Value == 1)) + { + // makeupTaskData.SetStatus(MakeupTaskStatus.Inline); + // makeupTaskData.ch_time = GameHelper.GetNowTime() + ConfigSystem.GetCommonConf().BalanceExpired * 3600; + // DataMgr.MakeupTaskHistory.Save(); + // InitView(); + GameHelper.ShowLoading(1, 2, () => + { + ConsumeSystem.Consume(vo.item, vo.item_need, isSuccess => + { + makeupTaskData.SetStatus(MakeupTaskStatus.Inline); + makeupTaskData.inlineInitNum = + CommonHelper.RandomRange(ConfigSystem.GetCommonConf().inlineInitNum[0], + ConfigSystem.GetCommonConf().inlineInitNum[1]); + makeupTaskData.inlineNum = CommonHelper.RandomRange( + ConfigSystem.GetCommonConf().inlineInitNum[0], + makeupTaskData.inlineInitNum); + makeupTaskData.order_time = GameHelper.GetNowTime(); + DataMgr.MakeupTaskHistory.Save(); + GameDispatcher.Instance.Dispatch(GameMsg.Update102); + //OnInline(); + // Debug.Log(JsonConvert.SerializeObject(vo)); + if (vo.id == 1) + { + TrackKit.SendEvent(ADEventTrack.WithdrawEvent,ADEventTrack.Property.WithdrawCash,1); + + } + else if (vo.id == 2) + { + TrackKit.SendEvent(ADEventTrack.WithdrawEvent,ADEventTrack.Property.WithdrawCash, 2); + } + else if (vo.id == 3) + { + TrackKit.SendEvent(ADEventTrack.WithdrawEvent,ADEventTrack.Property.WithdrawCash, 3); + } + if (vo.id != 3) + { + ch_index++; + } + InitView(); + if (vo.id == 3) + { + // PlayerPrefs.SetInt("ch_lv", 2); + // SaveData.GetSaveObject().chout_lv = 2; + // SaveData.SaveDataFunc(); + makeupTaskData = DataMgr.MakeupTaskHistory.Value.Last(); + } + + }); + }); + } + else + { + makeupTaskData.SetStatus(MakeupTaskStatus.Level); + makeupTaskData.ch_time = GameHelper.GetNowTime() + ConfigSystem.GetCommonConf().BalanceExpired * 3600; + DataMgr.MakeupTaskHistory.Save(); + InitView(); + } + } + else + { + CtrlCloseUI(); + // UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.H5UI_Open); + // MainTabUI.getIns().OnGameTab(1); + } + }); + } + else + { + (ui.btn_chout as btn_get).state.selectedIndex = 1; + ui.btn_chout.SetClick(() => + { + GameHelper.ShowTips("The AD viewing task has not been completed."); + }); + } + } + + private void OnInline() + { + CheckBtnWatchStatus(); + + ui.cont_state.selectedIndex = 3; + + ui.text_payhint.SetVar("account", DataMgr.ExchangeAccount.Value).FlushVars(); + + ui.text_query.SetVar("cur", makeupTaskData.inlineNum.ToString()) + .SetVar("tol", makeupTaskData.inlineInitNum.ToString()).FlushVars(); + + CheckActive(makeupTaskData.tableId); + GameDispatcher.Instance.Dispatch(GameMsg.RefreshMakeupData); + ui.btn_tab.SetClick(CtrlCloseUI); + + + + RefreshRecordData(); + } + + + private void RefreshRecordData() + { + var data = makeupTaskData; + if (data.inlineNum <= 1 && GameHelper.isRDExchangeMode()) + { + ui.cont_confirm.selectedIndex = 0; + ui.btn_inline_ok.SetClick(() => + { + makeupTaskData.SetStatus(MakeupTaskStatus.editAccount); + DataMgr.MakeupTaskHistory.Save(); + InitView(); + }); + + // return; + } + else + { + ui.cont_confirm.selectedIndex = 1; + } + + + var com_rank = ui.com_newRecord.com_rank; + com_rank.lab_title_des.text = GameHelper.getDesByKey("makeup_7"); + com_rank.lab_rank_tips.text = GameHelper.getDesByKey("makeup_8"); + + var rdVOModel = ConfigSystem.GetConfig() + .FirstOrDefault(rd => rd.id == data.tableId); + if (rdVOModel == null) return; + + if (rdVOModel.AD_Limit_times <= data.WatchVideoSpeedNum) + { + ui.btn_watch.enabled = false; + ui.btn_watch.visible = false; + com_rank.content1.selectedIndex = 1; + com_rank.text_rank1.SetVar("rank", data.WatchVideoSpeedNum.ToString()).FlushVars(); + } + else + { + ui.btn_watch.enabled = true; + ui.btn_watch.visible = true; + com_rank.content1.selectedIndex = 0; + com_rank.text_rank1.SetVar("rank", rdVOModel.AD_Down.ToString()).FlushVars(); + } + + if (rdVOModel.Login_Limit_times <= data.loginSpeedNum) + { + com_rank.content2.selectedIndex = 1; + com_rank.text_rank2.SetVar("rank", rdVOModel.Login_Limit_times.ToString()).FlushVars(); + } + else + { + com_rank.content2.selectedIndex = 0; + var loginRans = GameHelper.GetCommonModel().inlineLoginDown[0] + "-" + GameHelper.GetCommonModel().inlineLoginDown[1]; + com_rank.text_rank2.SetVar("rank", loginRans).FlushVars(); + } + + if (rdVOModel.Active_Limit_times <= data.activeSpeedNum) + { + com_rank.content3.selectedIndex = 1; + com_rank.text_rank3.SetVar("rank", rdVOModel.Active_Limit_times.ToString()).FlushVars(); + } + else + { + com_rank.content3.selectedIndex = 0; + + com_rank.text_rank3.SetVar("time", rdVOModel.Active_time.ToString()).FlushVars(); + com_rank.text_rank3.SetVar("rank", rdVOModel.Active_time_Down.ToString()).FlushVars(); + + if (CommonHelper.activeTimes.TryGetValue(data.tableId, out int openTimes)) + { + Debug.Log($"openTimes ===== {openTimes}, data.tableId=== activeTimes_{data.tableId}"); + if (openTimes > 1) + { + //活跃的分钟数 + int min_num = ((int)Time.time - data.activeMinute) / 60; + + //是配置的活跃时间的多少倍 + int active_times = min_num / rdVOModel.Active_time; + + Debug.Log($"min_num=== {min_num} {active_times} "); + if (active_times > 0) + { + data.activeMinute = (int)Time.time; + // 可以加速多少排名 + int rank_num = active_times * rdVOModel.Active_time_Down; + var last = data.activeSpeedNum; + + if (data.activeSpeedNum > rdVOModel.Active_Limit_times) + { + // rank_num = rdVOModel.Active_Limit_times - last; + data.activeSpeedNum = rdVOModel.Active_Limit_times; + } + else + { + if (data.activeSpeedNum + rank_num > rdVOModel.Active_Limit_times) rank_num = rdVOModel.Active_Limit_times - data.activeSpeedNum; + data.activeSpeedNum += rank_num; + data.inlineNum -= rank_num; + } + Debug.Log($"订单为: {data.tableId} 通过活跃时间减少的排名为:{rank_num}"); + + if (data.inlineNum < GameHelper.GetCommonModel().inlineMin) + { + data.inlineNum = GameHelper.GetCommonModel().inlineMin; + } + } + } + else + { + data.activeMinute = (int)Time.time; + } + } + } + + com_rank.text_ranks.text = data.inlineNum.ToString(); + } + + void onTicket() + { + var vo = MakeupModel.GetData(makeupTaskData.tableId); + ui.cont_state.selectedIndex = 6; + ui.lab_mn.text = ui.lab_mn.text; + + if (makeupTaskData.rdData != null && makeupTaskData.rdData.Count > 0) + { + makeupTaskData.rdData.Sort((a, b) => + { + if (a.isClaimed == b.isClaimed) + { + return b.coupon_mount.CompareTo(a.coupon_mount); + } + else + { + return a.isClaimed ? 1 : -1; + } + }); + } + else + { + makeupTaskData.rdData = new List(); + int[] arr = ConfigSystem.GetCommonConf().BalanceExchange; + Array.Sort(arr, (a, b) => b.CompareTo(a)); + int remainValue = vo.item_need; + List tickets = new List(); + for (int i = 0; i < arr.Length; i++) + { + tickets.Add(remainValue / arr[i]); + remainValue = remainValue % arr[i]; + for (int j = 0; j < tickets[i]; j++) + { + makeupRdData data = new makeupRdData(); + data.code = GameHelper.GenerateUniqueKey(vo, j); + data.coupon_mount = arr[i]; + data.isClaimed = false; + makeupTaskData.rdData.Add(data); + } + } + DataMgr.MakeupTaskHistory.Save(); + } + + int value = 0; + for (int i = 0; i < makeupTaskData.rdData.Count; i++) + { + if (makeupTaskData.rdData[i].isClaimed) + { + value += makeupTaskData.rdData[i].coupon_mount; + } + } + ui.lab_mn.text = GameHelper.Get101Str(vo.item_need - value); + + ui.list_kicket.itemRenderer = refreshItem; + ui.list_kicket.numItems = makeupTaskData.rdData.Count; + } + + private void refreshItem(int index, GObject obj) + { + com_ticket_item item = (com_ticket_item)obj; + + item.lab_num.text = GameHelper.GetPriceInt(makeupTaskData.rdData[index].coupon_mount); + + if (makeupTaskData.rdData[index].isClaimed) + { + item.btn_claim.state.selectedIndex = 1; + item.btn_claim.title = "Claimed"; + } + else + { + item.btn_claim.state.selectedIndex = 0; + item.btn_claim.title = "Claim"; + } + + item.btn_claim.SetClick(() => + { + makeupTaskData.SetStatus(MakeupTaskStatus.code); + makeupTaskData.rdData[index].isClaimed = true; + makeupTaskData.lastRdData = makeupTaskData.rdData[index]; + DataMgr.MakeupTaskHistory.Save(); + + onCode(); + }); + } + + void onCode() + { + if (makeupTaskData.lastRdData == null) + { + ui.cont_state.selectedIndex = 6; + makeupTaskData.SetStatus(MakeupTaskStatus.ticket); + return; + } + ui.cont_state.selectedIndex = 7; + + int value = 0; + for (int i = 0; i < makeupTaskData.rdData.Count; i++) + { + if (makeupTaskData.rdData[i].isClaimed) + { + value += makeupTaskData.rdData[i].coupon_mount; + } + } + + var vo = MakeupModel.GetData(makeupTaskData.tableId); + ui.lab_mn2.text = GameHelper.Get101Str(vo.item_need - value); + ui.lab_ticket.text = GameHelper.GetPriceInt(makeupTaskData.lastRdData.coupon_mount); + ui.lab_code.text = makeupTaskData.lastRdData.code; + + ui.btn_back.SetClick(() => + { + ui.cont_state.selectedIndex = 6; + makeupTaskData.SetStatus(MakeupTaskStatus.ticket); + InitView(); + }); + + ui.btn_copy.SetClick(() => + { + GameHelper.CopyText(ui.lab_code.text); + }); + + ui.btn_contact_us.SetClick(() => + { + // GameHelper.OpenEmail(); + SDKOpenConfig openConfig = new SDKOpenConfig + { + normal = false, + url = vo.T_ShopURL + }; + + CtrlDispatcher.Instance.Dispatch(CtrlMsg.open_wb,openConfig); + + CtrlCloseUI(); + }); + + } + + void CheckBtnWatchStatus() + { + var data = makeupTaskData; + + if (data == null) + { + return; + } + var CardRdVOModel = ConfigSystem.GetConfig() + .FirstOrDefault(rd => rd.id == data.tableId); + if (CardRdVOModel == null) return; + + bool isShow = CardRdVOModel.AD_Limit_times > data.WatchVideoSpeedNum && data.inlineNum > GameHelper.GetCommonModel().inlineMin; + + ui.btn_watch.enabled = isShow; + + } + + void updateSpeedCD() + { + var lastTimes = PlayerPrefs.GetInt($"speed_ad_cool_times_{userUid}", 0); + if (GameHelper.GetNowTime() < lastTimes + ad_cool_down) + { + ui.btn_watch.enabled = false; + ui.btn_watch.show_cd.selectedIndex = 1; + ui.btn_watch.text_cd.text = CommonHelper.TimeFormat( + lastTimes + ad_cool_down - Convert.ToInt32(GameHelper.GetNowTime()), + CountDownType.Hour); + } + else + { + + ui.btn_watch.enabled = true; + ui.btn_watch.show_cd.selectedIndex = 0; + } + + } + + private void CheckActive(int index) + { + if (CommonHelper.activeTimes.TryGetValue(index, out int value)) + { + value++; + // Debug.Log($"CheckActive2: {index} {value}"); + CommonHelper.activeTimes[index] = value; + + } + else + { + CommonHelper.activeTimes.Add(index, 1); + } + + } + + void WatchBtnClick() + { + + if (GameHelper.GetNowTime() <= PlayerPrefs.GetInt($"speed_ad_cool_times_{userUid}", 0) + ad_cool_down) + { + Debug.Log("not click"); + return; + } + + GameHelper.ShowVideoAd("reward_OpeningDollarBills", isSuccess => + { + if (isSuccess) + { + ui.btn_watch.enabled = false; + // TimerHelper.mEasy.AddTimer(1.5f, () => + // { + var ad_times = Convert.ToInt32(GameHelper.GetNowTime()); + PlayerPrefs.SetInt($"speed_ad_cool_times_{userUid}", ad_times); + InitView(); + // }); + + } + }); + + // var adNum = DataMgr.RealWatchVideo; + // Debug.Log($"adNum========: {adNum}"); + } + + void taskWatchBtnClick() + { + GameHelper.ShowVideoAd("taskWatchAd", (issuccess) => + { + if (issuccess) + { + var ad_times = Convert.ToInt32(GameHelper.GetNowTime()); + SaveData.GetSaveObject()._watch_ad_cd = ad_times + GameHelper.GetCommonModel().exchangeCD; + + btn_watchAd btn_task_watch = ui.btn_task_watch as btn_watchAd; + btn_task_watch.enabled = false; + btn_task_watch.can_buy.selectedIndex = 1; + btn_task_watch.btn_text.text = CommonHelper.TimeFormat(SaveData.GetSaveObject()._watch_ad_cd - Convert.ToInt32(GameHelper.GetNowTime()), CountDownType.Hour); + HallManager.Instance.UpdateSecondEvent += upTaskWatchAdsBtn; + + OnTask(); + } + }); + } + + public void upTaskWatchAdsBtn() + { + var lastTimes = SaveData.GetSaveObject()._watch_ad_cd; + btn_watchAd btn_task_watch = ui.btn_task_watch as btn_watchAd; + btn_task_watch.img_saveingpot.visible = false; + if (GameHelper.GetNowTime() < lastTimes) + { + btn_task_watch.enabled = false; + btn_task_watch.can_buy.selectedIndex = 1; + btn_task_watch.btn_text.text = CommonHelper.TimeFormat(lastTimes - Convert.ToInt32(GameHelper.GetNowTime()), CountDownType.Hour); + } + else + { + HallManager.Instance.UpdateSecondEvent -= upTaskWatchAdsBtn; + btn_task_watch.enabled = true; + btn_task_watch.can_buy.selectedIndex = 0; + if (GameHelper.IsGiftSwitch() && ConfigSystem.GetCommonConf().PiggyBankSwitch == 1) btn_task_watch.img_saveingpot.visible = true; + } + } + + void LvWatchBtnClick() + { + GameHelper.ShowVideoAd("LevelWatchAd", (issuccess) => + { + if (issuccess) + { + var ad_times = Convert.ToInt32(GameHelper.GetNowTime()); + SaveData.GetSaveObject()._watch_ad_cd = ad_times + GameHelper.GetCommonModel().exchangeCD; + + btn_watchAd btn_watchad = ui.btn_watchad as btn_watchAd; + btn_watchad.enabled = false; + btn_watchad.can_buy.selectedIndex = 1; + btn_watchad.btn_text.text = CommonHelper.TimeFormat(SaveData.GetSaveObject()._watch_ad_cd - Convert.ToInt32(GameHelper.GetNowTime()), CountDownType.Hour); + HallManager.Instance.UpdateSecondEvent += upLvWatchAdsBtn; + // makeupTaskData.cash_time = GameHelper.GetNowTime() + ConfigSystem.GetCommonConf().BalanceExpired * 3600; + InitView(); + } + }); + } + + public void upLvWatchAdsBtn() + { + var lastTimes = SaveData.GetSaveObject()._watch_ad_cd; + btn_watchAd btn_watchad = ui.btn_watchad as btn_watchAd; + btn_watchad.img_saveingpot.visible = false; + + if (GameHelper.GetNowTime() < lastTimes) + { + btn_watchad.enabled = false; + btn_watchad.can_buy.selectedIndex = 1; + btn_watchad.btn_text.text = CommonHelper.TimeFormat(lastTimes - Convert.ToInt32(GameHelper.GetNowTime()), CountDownType.Hour); + } + else + { + HallManager.Instance.UpdateSecondEvent -= upLvWatchAdsBtn; + btn_watchad.enabled = true; + btn_watchad.can_buy.selectedIndex = 0; + if (GameHelper.IsGiftSwitch() && ConfigSystem.GetCommonConf().PiggyBankSwitch == 1) btn_watchad.img_saveingpot.visible = true; + } + } + } +} +namespace IgnoreOPS +{ + + + public class PaymentMsg + { + + public string email; + public string first_name; + public string last_name; + + } + +} diff --git a/Assets/Scripts/ModuleUI/MakeupConfirm/MakeupConfirmUI.cs.meta b/Assets/Scripts/ModuleUI/MakeupConfirm/MakeupConfirmUI.cs.meta new file mode 100644 index 00000000..45224c0c --- /dev/null +++ b/Assets/Scripts/ModuleUI/MakeupConfirm/MakeupConfirmUI.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e6be431a6f2064440bad70eda1509499 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/ModuleUI/MakeupConfirm/MakeupConfirmUICtrl.cs b/Assets/Scripts/ModuleUI/MakeupConfirm/MakeupConfirmUICtrl.cs new file mode 100644 index 00000000..1081862d --- /dev/null +++ b/Assets/Scripts/ModuleUI/MakeupConfirm/MakeupConfirmUICtrl.cs @@ -0,0 +1,72 @@ +namespace RedHotRoast + +{ + public class MakeupConfirmUICtrl : BaseUICtrl + { + private MakeupConfirmUI ui; + private MakeupConfirmModel model; + + private uint openUIMsg = UICtrlMsg.MakeupConfirmUI_Open; + private uint closeUIMsg = UICtrlMsg.MakeupConfirmUI_Close; + + #region 生命周期 + protected override void OnInit() + { + //model = ModuleManager.Instance.GetModel(ModelConst.MakeupConfirmModel) as MakeupConfirmModel; + } + + protected override void OnDispose() + { + } + + public override void OpenUI(object args = null) + { + if (ui == null) + { + ui = new MakeupConfirmUI(this); + ui.Open(args); + } + } + + public override void CloseUI(object args = null) + { + if (ui != null && !ui.isClose) + { + ui.Close(); + } + ui = null; + } + #endregion + + #region 消息 + public override uint GetOpenUIMsg(string uiName) + { + return openUIMsg; + } + public override uint GetCloseUIMsg(string uiName) + { + return closeUIMsg; + } + + protected override void AddListener() + { + uiCtrlDispatcher.AddListener(openUIMsg, OpenUI); + uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI); + } + protected override void RemoveListener() + { + uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI); + uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI); + } + + protected override void AddServerListener() + { + + } + protected override void RemoveServerListener() + { + + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/MakeupConfirm/MakeupConfirmUICtrl.cs.meta b/Assets/Scripts/ModuleUI/MakeupConfirm/MakeupConfirmUICtrl.cs.meta new file mode 100644 index 00000000..386f04ce --- /dev/null +++ b/Assets/Scripts/ModuleUI/MakeupConfirm/MakeupConfirmUICtrl.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 53f46aa2e5a8b449cb58a52b8c97a086 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/ModuleUI/OpenGame/OpenGameUI.cs b/Assets/Scripts/ModuleUI/OpenGame/OpenGameUI.cs index a297ea81..9c98d2f2 100644 --- a/Assets/Scripts/ModuleUI/OpenGame/OpenGameUI.cs +++ b/Assets/Scripts/ModuleUI/OpenGame/OpenGameUI.cs @@ -47,25 +47,24 @@ namespace RedHotRoast protected override void OnOpenBefore(object args) { + ui.state.selectedIndex = GameHelper.IsGiftSwitch() ? 1 : 0; + + if (GameHelper.IsGiftSwitch()) + { + ((FGUI.ZM_Common_01.com_open_tips)ui.com_tips).t0.Play(() => + { + DOVirtual.DelayedCall(0.2f, () => + { + UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.OpenGameUI_Close); + }); + }); + + return; + } + DOVirtual.DelayedCall(0.7f, () => { GameDispatcher.Instance.Dispatch(GameMsg.reset_game, args); }); InitView(); - // DOVirtual.DelayedCall(0.2f, () => - // { - // if (GameHelper.GetLevel() - 1 < ConfigSystem.GetLevelUnlockConfig().Count&&GameHelper.IsGiftSwitch()) - // { - // LevelUnlock levelUnlock_ = ConfigSystem.GetLevelUnlockConfig()[GameHelper.GetLevel() - 1]; - // if (levelUnlock_.LeveType != 0) - // { - // if (!DataMgr.LevelUnlockList.Value.Contains(GameHelper.GetLevel() - 1)) - // { - // uiCtrlDispatcher.Dispatch(UICtrlMsg.UnlockLevelUI_Open, GameHelper.GetLevel() - 1); - // } - // } - // } - // }); - - - + if (AudioManager.Instance.IsOpenEffect) { AudioManager.Instance.PlayDynamicEffect(AudioConst.game_open); @@ -107,19 +106,7 @@ namespace RedHotRoast DOVirtual.DelayedCall(1.5f, () => { - // ui.tips_node1.visible = true; - // var open_bg = FXManager.Instance.SetFx(ui.tips_node1, Fx_Type.fx_open_bg, ref closeCallback); - // open_bg.state.SetAnimation(0, "animation", true); - // ui.tips_node1.SetScale(1.25f, 1.25f); - // - // ui.tips_node.visible = true; - // var open_game = FXManager.Instance.SetFx(ui.tips_node, Fx_Type.fx_open, ref closeCallback); - // open_game.state.SetAnimation(0, "animation", false); - // open_game.state.Complete += (a) => - // { UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.OpenGameUI_Close); - // }; - }); } } diff --git a/Assets/Scripts/ModuleUI/Passunlock/PassunlockUI.cs b/Assets/Scripts/ModuleUI/Passunlock/PassunlockUI.cs index 73102ac2..44e0a620 100644 --- a/Assets/Scripts/ModuleUI/Passunlock/PassunlockUI.cs +++ b/Assets/Scripts/ModuleUI/Passunlock/PassunlockUI.cs @@ -130,7 +130,7 @@ namespace RedHotRoast } ui.text_allgold.text = GameHelper.Get101Str(gold); - // ui.btn_buypass.GetChild("title").text = "$" + ConfigSystem.GetConfig().Passportgift; + // ui.btn_buypass.GetChild("title").text = "$" + ConfigSystem.GetCommonConf().Passportgift; } diff --git a/Assets/Scripts/ModuleUI/PettyAward.meta b/Assets/Scripts/ModuleUI/PettyAward.meta new file mode 100644 index 00000000..49928fca --- /dev/null +++ b/Assets/Scripts/ModuleUI/PettyAward.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b89d7d8a78f842cda28df17d019716e6 +timeCreated: 1783665325 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/PettyAward/PettyAwardCtrl.cs b/Assets/Scripts/ModuleUI/PettyAward/PettyAwardCtrl.cs new file mode 100644 index 00000000..dc31e144 --- /dev/null +++ b/Assets/Scripts/ModuleUI/PettyAward/PettyAwardCtrl.cs @@ -0,0 +1,42 @@ +namespace RedHotRoast +{ + public class PettyAwardCtrl : BaseCtrl + { + public static PettyAwardCtrl Instance { get; private set; } + + private PettyAwardModel model; + + #region 生命周期 + protected override void OnInit() + { + Instance = this; + //model = ModuleManager.Instance..GetModel(ModelConst.PettyAwardModel) as PettyAwardModel; + } + + protected override void OnDispose() + { + Instance = null; + } + #endregion + + #region 消息 + protected override void AddListener() + { + + } + protected override void RemoveListener() + { + + } + + protected override void AddServerListener() + { + + } + protected override void RemoveServerListener() + { + + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/PettyAward/PettyAwardCtrl.cs.meta b/Assets/Scripts/ModuleUI/PettyAward/PettyAwardCtrl.cs.meta new file mode 100644 index 00000000..dae7afc5 --- /dev/null +++ b/Assets/Scripts/ModuleUI/PettyAward/PettyAwardCtrl.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 1261358ce7a049afb16f4553810bd5bf +timeCreated: 1766046260 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/PettyAward/PettyAwardModel.cs b/Assets/Scripts/ModuleUI/PettyAward/PettyAwardModel.cs new file mode 100644 index 00000000..5b115548 --- /dev/null +++ b/Assets/Scripts/ModuleUI/PettyAward/PettyAwardModel.cs @@ -0,0 +1,43 @@ +namespace RedHotRoast +{ + public class PettyAwardModel : BaseModel + { + #region 生命周期 + protected override void OnInit() + { + } + + protected override void OnDispose() + { + } + + // protected override void OnReset() + // { + // } + // #endregion + + // #region 读取数据 + // protected override void OnReadData() + // { + // } + // #endregion + + // #region 本地存储 + // protected override void WriteLocalStorage() + // { + + // } + #endregion + + #region 消息 + protected override void AddListener() + { + + } + protected override void RemoveListener() + { + + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/PettyAward/PettyAwardModel.cs.meta b/Assets/Scripts/ModuleUI/PettyAward/PettyAwardModel.cs.meta new file mode 100644 index 00000000..2d18138b --- /dev/null +++ b/Assets/Scripts/ModuleUI/PettyAward/PettyAwardModel.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 92b7e778079e4302b93e51da320ec76c +timeCreated: 1766046260 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/PettyAward/PettyAwardUI.cs b/Assets/Scripts/ModuleUI/PettyAward/PettyAwardUI.cs new file mode 100644 index 00000000..fe8f2233 --- /dev/null +++ b/Assets/Scripts/ModuleUI/PettyAward/PettyAwardUI.cs @@ -0,0 +1,341 @@ +using System; +using IgnoreOPS; +using UnityEngine; +using Spine.Unity; +using Newtonsoft.Json; +using SGModule.NetKit; + +namespace RedHotRoast +{ + public class PettyAwardUI : BaseUI + { + private PettyAwardUICtrl ctrl; + private PettyAwardModel model; + private FGUI.ZM_Petty.com_petty_award ui; + private Action closeCallback; + private Action open_sign; + private bool is_get = false; + public PettyAwardUI(PettyAwardUICtrl ctrl) : base(ctrl) + { + uiName = UIConst.PettyAwardUI; + this.ctrl = ctrl; + } + + protected override void SetUIInfo(UIInfo uiInfo) + { + uiInfo.packageName = "ZM_Petty"; + uiInfo.assetName = "com_petty_award"; + uiInfo.layerType = UILayerType.Popup; + uiInfo.isNeedOpenAnim = true; + uiInfo.isNeedCloseAnim = true; + uiInfo.isNeedUIMask = true; + } + + #region 生命周期 + protected override void OnInit() + { + model = ModuleManager.Instance.GetModel(ModelConst.PettyAwardModel) as PettyAwardModel; + } + + protected override void OnClose() + { + SaveData.SaveDataFunc(); + + GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, true); + + closeCallback?.Invoke(); + } + + protected override void OnBind() + { + ui = baseUI as FGUI.ZM_Petty.com_petty_award; + } + + protected override void OnOpenBefore(object args) + { + GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, false); + + InitView(); + } + + protected override void OnOpen(object args) + { + //open_sign = (System.Action)args; + } + + protected override void OnHide() + { + } + + protected override void OnDisplay(object args) + { + } + #endregion + + #region 消息 + protected override void AddListener() + { + + } + protected override void RemoveListener() + { + + } + #endregion + + + private int _mLastState; + //初始化页面逻辑 + private void InitView() + { + _mLastState = DataMgr.PettyState.Value; + // Debug.Log($"PettyState============: {DataMgr.PettyState.Value}"); + var num = ConfigSystem.GetCommonConf().SmallReward; + ui.com_get_panel.text_reward.text = $"{GameHelper.Get102Str(num)} USD"; + + + ui.com_get_panel.btn_get.SetClick(GotoEnterAccount); + ui.btn_close.SetClick(()=> + { + if (ui.state.selectedIndex == 4) + { + GotoEnterAccount(); + } + else + { + CtrlCloseUI(); + } + }); + + if (_mLastState == 0) + { + // var sk = FXManager.Instance.SetFx(ui.anim, Fx_Type.fx_petty_reward, ref closeCallback); + // sk.state.SetAnimation(0, "newbie_reward_an01", false); + // sk.state.Complete += (a) => + // { + // sk.state.SetAnimation(0, "newbie_reward_an02", true); + // ui.btn_gerAward.SetClick(() => + // { + // ui.btn_gerAward.visible = false; + // sk.state.SetAnimation(0, "newbie_reward_an03", false); + // sk.state.Complete += (a) => + // { + // ui.state.selectedIndex = 1; + // DataMgr.PettyState.Value = 1; + // ui.anim.visible = false; + // }; + // }); + // + // }; + ui.state.selectedIndex = 1; + DataMgr.PettyState.Value = 1; + } + else + { + GotoPanel(_mLastState); + } + } + + private void GotoPanel(int index) + { + switch (index) + { + case 1: + ui.state.selectedIndex = 1; + break; + case 2: + ui.state.selectedIndex = 2; + GotoEnterAccount(); + break; + case 3: + ui.state.selectedIndex = 3; + GotoDetail(); + break; + } + } + + private void GotoEnterAccount() + { + ui.state.selectedIndex = 2; + DataMgr.PettyState.Value = 2; + if (!DataMgr.PettyAccount.Value.IsNullOrWhiteSpace()) + { + ui.com_account.com_email.enter_email.text = DataMgr.PettyAccount.Value; + } + if (!DataMgr.PettyFirstName.Value.IsNullOrWhiteSpace()) + { + ui.com_account.com_first_name.enter_first_name.text = DataMgr.PettyFirstName.Value; + } + if (!DataMgr.PettyLastName.Value.IsNullOrWhiteSpace()) + { + ui.com_account.com_last_name.enter_last_name.text = DataMgr.PettyLastName.Value; + } + + ui.com_account.btn_confirm.SetClick(ConfirmClick); + } + + private void ConfirmClick() + { + var account = ui.com_account.com_email.enter_email.text.Replace(" ", ""); + if (account == "") + { + GameHelper.ShowTips("Please enter the correct account information", true); + return; + } + + if (!GameHelper.CheckAccountValidly(account)) + { + GameHelper.ShowTips("Please enter the correct account information", true); + return; + } + + var fname = ui.com_account.com_first_name.enter_first_name.text.Replace(" ", ""); + if (!GameHelper.CheckNameValidly(fname)) + { + GameHelper.ShowTips("Please enter the correct account information", true); + return; + } + + var lname = ui.com_account.com_last_name.enter_last_name.text.Replace(" ", ""); + if (!GameHelper.CheckNameValidly(lname) && !AppConst.isPt()) + { + GameHelper.ShowTips("Please enter the correct account information", true); + return; + } + + DataMgr.PettyAccount.Value = account; + DataMgr.PettyFirstName.Value = fname; + DataMgr.PettyLastName.Value = lname; + + GotoSecondConfirm(account, fname, lname); + + } + + private void GotoSecondConfirm( string account, string fname, string lname) + { + ui.state.selectedIndex = 4; + PaymentMsg info = new PaymentMsg + { + email = account, + first_name = fname, + last_name = lname + }; + + ui.com_second_confirm.text_account.SetVar("account", account).FlushVars(); + ui.com_second_confirm.text_first_name.SetVar("name", fname).FlushVars(); + ui.com_second_confirm.text_last_name.SetVar("name", lname).FlushVars(); + + ui.com_second_confirm.btn_confirm.SetClick(() => + { + ui.com_second_confirm.btn_confirm.enabled = false; + + NetApi.PayOutUserInfo(account, + fname, lname, (isSuccess, obj) => + { + if (isSuccess) + { + GotoDetail(); + } + else + { + GameHelper.ShowTips("Failed to save information., please try again"); + ui.com_second_confirm.btn_confirm.enabled = true; + } + }); + }); + } + + private void GotoDetail() + { + ui.state.selectedIndex = 3; + DataMgr.PettyState.Value = 3; + + var pettyAmount = DataMgr.PettyAmount.Value; + if (pettyAmount != 0) + { + ui.com_detail.text_amount.SetVar("num", GameHelper.Get102Str(pettyAmount)).FlushVars(); + } + else + { + var num = GameHelper.GetCommonModel().SmallReward; + ui.com_detail.text_amount.SetVar("num", GameHelper.Get102Str(num)).FlushVars(); + DataMgr.PettyAmount.Value = num; + } + + var pettyDateTime = DataMgr.PettyDateTime.Value; + if (!pettyDateTime.IsNullOrWhiteSpace()) + { + ui.com_detail.text_data.SetVar("data", pettyDateTime).FlushVars(); + } + else + { + var dateTime = DateTime.Now.ToString("yyyy.MM.dd"); + ui.com_detail.text_data.SetVar("data",dateTime).FlushVars(); + DataMgr.PettyDateTime.Value = dateTime; + } + + var pettyOrderID = DataMgr.PettyOrderID.Value; + if (!pettyOrderID.IsNullOrWhiteSpace()) + { + ui.com_detail.text_order.SetVar("order", pettyOrderID).FlushVars(); + } + else + { + string datePart = DateTime.Now.ToString("yyyyMMdd"); + System.Random random = new System.Random(); + string randomPart = random.Next(1000, 9999).ToString(); // 生成1000-9999之间的四位数 + ui.com_detail.text_order.SetVar("order",datePart + randomPart).FlushVars(); + + DataMgr.PettyOrderID.Value = datePart + randomPart; + } + + + ui.com_detail.text_email.SetVar("email",DataMgr.PettyAccount.Value).FlushVars(); + + var pettyDataLimit = DataMgr.PettyDataLimit.Value; + if (pettyDataLimit != 0) + { + ui.com_detail.text_limit.SetVar("day", pettyDataLimit.ToString()).FlushVars(); + } + else + { + var day = ConfigSystem.GetCommonConf().ProcessingTime; + ui.com_detail.text_limit.SetVar("day", day.ToString()).FlushVars(); + DataMgr.PettyDataLimit.Value = day; + } + + if (IsPettyDataExpired()) + { + ui.com_detail.btn_redeem.visible = true; + ui.com_detail.btn_redeem.SetClick(() => + { + Debug.Log($"click redeem code view----------------------"); + UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.RedeemCodeUI_Open); + CtrlCloseUI(); + }); + } + } + + + public bool IsPettyDataExpired() + { + // 1. 获取保存的过期天数限制 + var pettyDataLimit = DataMgr.PettyDataLimit.Value; + + // 2. 获取当前日期(去掉时分秒,只保留日期部分,避免当天误判) + DateTime currentDate = DateTime.Now.Date; + + // 3. 获取数据保存时的日期 + DateTime saveDate = DateTime.ParseExact(DataMgr.PettyDateTime.Value, "yyyy.MM.dd", System.Globalization.CultureInfo.InvariantCulture); + + // 4. 计算时间差 + TimeSpan timeSpan = currentDate - saveDate; + + // 5. 判断是否超出限制天数 + bool isExpired = timeSpan.TotalDays >= pettyDataLimit; + + return isExpired; + } + + } +} diff --git a/Assets/Scripts/ModuleUI/PettyAward/PettyAwardUI.cs.meta b/Assets/Scripts/ModuleUI/PettyAward/PettyAwardUI.cs.meta new file mode 100644 index 00000000..0af8d68d --- /dev/null +++ b/Assets/Scripts/ModuleUI/PettyAward/PettyAwardUI.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 3976c01df34446138c677b09d9acbe64 +timeCreated: 1766046260 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/PettyAward/PettyAwardUICtrl.cs b/Assets/Scripts/ModuleUI/PettyAward/PettyAwardUICtrl.cs new file mode 100644 index 00000000..796f1fd6 --- /dev/null +++ b/Assets/Scripts/ModuleUI/PettyAward/PettyAwardUICtrl.cs @@ -0,0 +1,71 @@ +namespace RedHotRoast +{ + public class PettyAwardUICtrl : BaseUICtrl + { + private PettyAwardUI ui; + private PettyAwardModel model; + + private uint openUIMsg = UICtrlMsg.PettyAwardUI_Open; + private uint closeUIMsg = UICtrlMsg.PettyAwardUI_Close; + + #region 生命周期 + protected override void OnInit() + { + //model = ModuleManager.Instance.GetModel(ModelConst.PettyAwardModel) as PettyAwardModel; + } + + protected override void OnDispose() + { + } + + public override void OpenUI(object args = null) + { + if (ui == null) + { + ui = new PettyAwardUI(this); + ui.Open(args); + } + } + + public override void CloseUI(object args = null) + { + if (ui != null && !ui.isClose) + { + ui.Close(); + } + ui = null; + } + #endregion + + #region 消息 + public override uint GetOpenUIMsg(string uiName) + { + return openUIMsg; + } + public override uint GetCloseUIMsg(string uiName) + { + return closeUIMsg; + } + + protected override void AddListener() + { + uiCtrlDispatcher.AddListener(openUIMsg, OpenUI); + uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI); + } + protected override void RemoveListener() + { + uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI); + uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI); + } + + protected override void AddServerListener() + { + + } + protected override void RemoveServerListener() + { + + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/PettyAward/PettyAwardUICtrl.cs.meta b/Assets/Scripts/ModuleUI/PettyAward/PettyAwardUICtrl.cs.meta new file mode 100644 index 00000000..763adf37 --- /dev/null +++ b/Assets/Scripts/ModuleUI/PettyAward/PettyAwardUICtrl.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 8acb71d41fef451383c9046c42ba7a9d +timeCreated: 1766046260 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/Play/RainPlayUI.cs b/Assets/Scripts/ModuleUI/Play/RainPlayUI.cs index 2d52b015..3655c27e 100644 --- a/Assets/Scripts/ModuleUI/Play/RainPlayUI.cs +++ b/Assets/Scripts/ModuleUI/Play/RainPlayUI.cs @@ -1669,7 +1669,7 @@ namespace RedHotRoast float complte_progress = showResurgence(); if (GameHelper.GetLevelstate() != 0) { - // if ((complte_progress > ((float)ConfigSystem.GetConfig().FailedGiftProgress / 100)) && !is_resurgence) + // if ((complte_progress > ((float)ConfigSystem.GetCommonConf().FailedGiftProgress / 100)) && !is_resurgence) // { // // UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.ResurgenceUI_Open, complte_progress); @@ -1689,7 +1689,7 @@ namespace RedHotRoast } else { - // if ((complte_progress > ((float)ConfigSystem.GetConfig().FailedGiftProgress / 100)) && !is_resurgence) + // if ((complte_progress > ((float)ConfigSystem.GetCommonConf().FailedGiftProgress / 100)) && !is_resurgence) // { // // UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.ResurgenceUI_Open, complte_progress); diff --git a/Assets/Scripts/ModuleUI/SaveingPot.meta b/Assets/Scripts/ModuleUI/SaveingPot.meta new file mode 100644 index 00000000..28d849c2 --- /dev/null +++ b/Assets/Scripts/ModuleUI/SaveingPot.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 976a8c4cb1d64dc7a3a7a01b79859171 +timeCreated: 1783666276 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/SaveingPot/SaveingPotCtrl.cs b/Assets/Scripts/ModuleUI/SaveingPot/SaveingPotCtrl.cs new file mode 100644 index 00000000..ee3e776b --- /dev/null +++ b/Assets/Scripts/ModuleUI/SaveingPot/SaveingPotCtrl.cs @@ -0,0 +1,19 @@ +namespace RedHotRoast +{ + public class SaveingPotCtrl : BaseCtrl + { + public static SaveingPotCtrl Instance { get; private set; } + + private SaveingPotModel model; + + protected override void OnInit() + { + Instance = this; + } + + protected override void OnDispose() + { + Instance = null; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/SaveingPot/SaveingPotCtrl.cs.meta b/Assets/Scripts/ModuleUI/SaveingPot/SaveingPotCtrl.cs.meta new file mode 100644 index 00000000..b4367e47 --- /dev/null +++ b/Assets/Scripts/ModuleUI/SaveingPot/SaveingPotCtrl.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9e59681e9218143e58eea10a87070d4a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/ModuleUI/SaveingPot/SaveingPotModel.cs b/Assets/Scripts/ModuleUI/SaveingPot/SaveingPotModel.cs new file mode 100644 index 00000000..1321588c --- /dev/null +++ b/Assets/Scripts/ModuleUI/SaveingPot/SaveingPotModel.cs @@ -0,0 +1,13 @@ +namespace RedHotRoast +{ + public class SaveingPotModel : BaseModel + { + protected override void OnInit() + { + } + + protected override void OnDispose() + { + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/SaveingPot/SaveingPotModel.cs.meta b/Assets/Scripts/ModuleUI/SaveingPot/SaveingPotModel.cs.meta new file mode 100644 index 00000000..6622e3dc --- /dev/null +++ b/Assets/Scripts/ModuleUI/SaveingPot/SaveingPotModel.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ffa8bfa81fde34182899a4958a8aa4c1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/ModuleUI/SaveingPot/SaveingPotUI.cs b/Assets/Scripts/ModuleUI/SaveingPot/SaveingPotUI.cs new file mode 100644 index 00000000..34661dd7 --- /dev/null +++ b/Assets/Scripts/ModuleUI/SaveingPot/SaveingPotUI.cs @@ -0,0 +1,1036 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using DG.Tweening; +using DontConfuse; +using IgnoreOPS; +using IgnoreOPS; +using FairyGUI; +using FGUI.ZM_Common_01; +using FGUI.tixian; +using IgnoreOPS; +using SGModule.Net; +using SGModule.NetKit; +using Spine.Unity; +using UnityEngine; +using Random = UnityEngine.Random; + +namespace RedHotRoast +{ + public class SaveingPotUI : BaseUI + { + private SaveingPotUICtrl ctrl; + private SaveingPotModel model; + private FGUI.tixian.com_saveingpot ui; + + private SaveingPotClass makeupTaskData; + public int ad_cool_down = 120; + private int broadtime = 1; + + public SaveingPotUI(SaveingPotUICtrl ctrl) : base(ctrl) + { + uiName = UIConst.SaveingPotUI; + this.ctrl = ctrl; + } + + protected override void SetUIInfo(UIInfo uiInfo) + { + uiInfo.packageName = "tixian"; + uiInfo.assetName = "com_saveingpot"; + uiInfo.layerType = UILayerType.Popup; + uiInfo.isNeedOpenAnim = false; + uiInfo.isNeedCloseAnim = false; + uiInfo.isNeedUIMask = true; + } + + #region 生命周期 + protected override void OnInit() + { + + } + + protected override void OnClose() + { + GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, true); + + AdExchangeManager.Instance.Destroy(); + HallManager.Instance.UpdateSecondEvent -= updateSpeedCD; + HallManager.Instance.UpdateSecondEvent -= Update; + HallManager.Instance.UpdateSecondEvent -= upLvWatchAdsBtn; + closeCallback?.Invoke(); + // WebviewManager.ShezhiACT(true); + WebviewManager.Instance.SetDarkThough(true); + + GameDispatcher.Instance.Dispatch(GameMsg.RefreshSaveingPot); + + // if (SaveLocalData.GetSaveLocalObject().rankRewardData.Count > 0 && !HallManager.Instance.isShowRankView) + // { + // HallManager.Instance.isShowRankView = true; + // uiCtrlDispatcher.Dispatch(UICtrlMsg.RankRewardUI_Open); + // } + } + protected override void OnBind() + { + ui = baseUI as FGUI.tixian.com_saveingpot; + } + + protected override void OnOpenBefore(object args) + { + GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, false); + + if (Screen.safeArea.y != 0) + {//刘海屏 + ui.group_.y += Screen.safeArea.y; + } + + // WebviewManager.ShezhiACT(false); + WebviewManager.Instance.SetDarkThough(false); + + UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.BuygoldUI_Close); + + + SaveingPotHelper.TestingClearTime(); + makeupTaskData = SaveData.GetSaveObject().saveingpot_history[SaveData.GetSaveObject().saveingpot_history.Count - 1]; + makeupTaskData.H5Time = 99999999; + // SaveData.GetSaveObject().saveingpot_ch = 999; //zhushi + ske_pot = FXManager.Instance.SetFx(ui.ani_potparent, Fx_Type.fx_saving, ref closeCallback); + ske_pot.state.SetAnimation(0, "edie", true); + ui.btn_close.SetClick(() => + { + CtrlCloseUI(); + }); + InitView(); + + if (GameHelper.IsGiftSwitch() && ConfigSystem.GetCommonConf().PiggyBankSwitch == 1) + { + ui.btn_watch.GetChild("img_saveingpot").visible = true; + } + + ui.btn_watch.SetClick(WatchBtnClick); + AdExchangeManager.Instance.SetWatchAd(AdExchangeManager.SavingPotMakeupAd, ui.btn_task_watch as btn_watchAd, () => { }); + AdExchangeManager.Instance.Start(); + + ad_cool_down = ConfigSystem.GetCommonConf().WwalaccelerationCD; + HallManager.Instance.UpdateSecondEvent += updateSpeedCD; + HallManager.Instance.UpdateSecondEvent += Update; + updateSpeedCD(); + InitBroadCast(); + + HallManager.Instance.UpdateSecondEvent += upLvWatchAdsBtn; + upLvWatchAdsBtn(); + + } + + protected override void OnOpen(object args) + { + } + + protected override void OnHide() + { + } + + protected override void OnDisplay(object args) + { + } + #endregion + + #region 消息 + protected override void AddListener() + { + } + protected override void RemoveListener() + { + } + #endregion + + private void Update() + { + if (ui.type.selectedIndex == 4) + { + OnTask(); + } + } + private SkeletonAnimation ske_pot; + private Action closeCallback; + //初始化页面逻辑 + private void InitView() + { + Debug.Log($"DataMgr.ExchangeAccount====={DataMgr.ExchangeAccount.Value}"); + Makeup_2 makeupVo = MakeupModel_2.GetData(makeupTaskData.tableId); + ui.text_ad.text = string.Format(GameHelper.getDesByKey("saving_pot_5"), makeupVo.ADIncrease); + string str = string.Format(GameHelper.getDesByKey("saving_pot_2"), makeupVo.PayIncrease); + ui.text_pay.text = str; + initTop(); + + ske_pot.SetActive(false); + string val = $"{SaveData.GetSaveObject().saveingpot_ch:N}"; + ui.text_lose.SetVar("num", val).FlushVars(); + // ui.text_lose.text = string.Format(ui.text_lose.text, SaveingPotHelper.getChString(SaveData.GetSaveObject().saveingpot_ch)); + if (makeupTaskData.needShowAni) + { + ui.type.selectedIndex = 0; + + ui.text_chprogress.text = SaveingPotHelper.getChNumber(SaveData.GetSaveObject().saveingpot_ch) + "/" + SaveingPotHelper.getChNumber(makeupTaskData.amount); + ui.progress_ch.value = (SaveData.GetSaveObject().saveingpot_ch / makeupTaskData.amount) * 100; + ske_pot.SetActive(true); + Debug.Log("iiiiiiiiiiiiiiiiiiiii"); + if (SaveData.GetSaveObject().saveingpot_ch < makeupTaskData.amount) + { + ((btn_watchAd)ui.btn_ch).watch.text = "Go"; + ui.btn_ch.SetClick(() => + { + GameHelper.ShowVideoAd("SaveingPotAd", isSuccess => + { + if (isSuccess) + { + var ad_times = Convert.ToInt32(GameHelper.GetNowTime()); + SaveData.GetSaveObject()._watch_ad_cd = ad_times + GameHelper.GetCommonModel().exchangeCD; + + btn_watchAd btnWatchad = ui.btn_ch as btn_watchAd; + btnWatchad.enabled = false; + btnWatchad.can_buy.selectedIndex = 1; + btnWatchad.btn_text.text = CommonHelper.TimeFormat(SaveData.GetSaveObject()._watch_ad_cd - Convert.ToInt32(GameHelper.GetNowTime()), CountDownType.Hour); + HallManager.Instance.UpdateSecondEvent += upLvWatchAdsBtn; + InitView(); + } + }); + }); + + } + else + { + btn_watchAd btnWatchad = ui.btn_ch as btn_watchAd; + btnWatchad.enabled = true; + btnWatchad.buy_state.selectedIndex = 1; + btnWatchad.title = "GET GIFT CARD"; + btnWatchad.SetClick(() => + { + makeupTaskData.needShowAni = false; + SaveData.SaveDataFunc(); + InitView(); + }); + } + if (SaveData.GetSaveObject().saveingpot_ch > SaveData.GetSaveObject().last_saveingpot_ch) + { + DOVirtual.Float(SaveData.GetSaveObject().last_saveingpot_ch, SaveData.GetSaveObject().saveingpot_ch, 1, + value => { ui.text_nowch.text = GameHelper.Get102Str((decimal)value); }); + ske_pot.state.SetAnimation(0, "getcash", false); + ske_pot.state.Complete += (a) => + { + ske_pot.state.SetAnimation(0, "edie", true); + }; + } + else ui.text_nowch.text = GameHelper.Get102Str((decimal)SaveData.GetSaveObject().saveingpot_ch); + SaveData.GetSaveObject().last_saveingpot_ch = SaveData.GetSaveObject().saveingpot_ch; + SaveData.SaveDataFunc(); + } + else if (makeupTaskData.status == SaveingPotTaskStatus.None) + { + if (DataMgr.ExchangeAccount.Value == null) + { + Debug.Log("enter"); + OnEnter(); + } + else + { + OnConfirm(); + } + } + else if (makeupTaskData.status == SaveingPotTaskStatus.Task) + { + OnTask(); + } + else if (makeupTaskData.status == SaveingPotTaskStatus.Inline) + { + // makeupTaskData.status = SaveingPotTaskStatus.ticket; + // DataMgr.MakeupTaskHistory.Save(); + // InitView(); + // return; + OnInline(); + Debug.Log("inline"); + } + else if (makeupTaskData.status == SaveingPotTaskStatus.ticket) + { + onTicket(); + } + else if (makeupTaskData.status == SaveingPotTaskStatus.code) + { + onCode(); + } + + } + void WatchBtnClick() + { + + if (GameHelper.GetNowTime() <= PlayerPrefs.GetInt($"speed_ad_cool_times_pot", 0) + ad_cool_down) + { + Debug.Log("not click"); + return; + } + + GameHelper.ShowVideoAd("reward_OpeningDollarBills", isSuccess => + { + if (isSuccess) + { + ui.btn_watch.enabled = false; + // TimerHelper.mEasy.AddTimer(1.5f, () => + // { + var ad_times = Convert.ToInt32(GameHelper.GetNowTime()); + PlayerPrefs.SetInt($"speed_ad_cool_times_pot", ad_times); + InitView(); + // }); + } + }); + + // var adNum = DataMgr.RealWatchVideo; + // Debug.Log($"adNum========: {adNum}"); + + } + void updateSpeedCD() + { + broadtime++; + BroadCast(); + if (makeupTaskData.needShowAni) + { + ui.text_remaintime.text = CommonHelper.TimeFormat((int)makeupTaskData.clear_time - Convert.ToInt32(GameHelper.GetNowTime()), CountDownType.Day); + + } + if (SaveingPotHelper.TestingClearTime()) + { + InitView(); + } + var lastTimes = PlayerPrefs.GetInt($"speed_ad_cool_times_pot", 0); + if (GameHelper.GetNowTime() < lastTimes + ad_cool_down) + { + ui.btn_watch.enabled = false; + ui.btn_watch.show_cd.selectedIndex = 1; + ui.btn_watch.text_cd.text = CommonHelper.TimeFormat( + lastTimes + ad_cool_down - Convert.ToInt32(GameHelper.GetNowTime()), + CountDownType.Hour); + } + else + { + + ui.btn_watch.enabled = true; + ui.btn_watch.show_cd.selectedIndex = 0; + } + } + + private void upLvWatchAdsBtn() + { + var lastAdTimes = SaveData.GetSaveObject()._watch_ad_cd; + btn_watchAd btn_watchad = ui.btn_ch as btn_watchAd; + btn_watchad.img_saveingpot.visible = false; + + if (SaveData.GetSaveObject().saveingpot_ch >= makeupTaskData.amount) + { + HallManager.Instance.UpdateSecondEvent -= upLvWatchAdsBtn; + InitView(); + return; + } + + if (GameHelper.GetNowTime() < lastAdTimes) + { + btn_watchad.enabled = false; + btn_watchad.can_buy.selectedIndex = 1; + btn_watchad.btn_text.text = CommonHelper.TimeFormat(lastAdTimes - Convert.ToInt32(GameHelper.GetNowTime()), CountDownType.Hour); + } + else + { + HallManager.Instance.UpdateSecondEvent -= upLvWatchAdsBtn; + btn_watchad.enabled = true; + btn_watchad.can_buy.selectedIndex = 0; + if (GameHelper.IsGiftSwitch() && ConfigSystem.GetCommonConf().PiggyBankSwitch == 1) btn_watchad.img_saveingpot.visible = true; + } + } + + + private void OnInline() + { + CheckBtnWatchStatus(); + + ui.type.selectedIndex = 5; + + + CheckActive(makeupTaskData.tableId); + GameDispatcher.Instance.Dispatch(GameMsg.RefreshMakeupData); + + + RefreshRecordData(); + } + + private void RefreshRecordData() + { + var data = makeupTaskData; + if (data.inlineNum <= 1) + { + if (GameHelper.isRDExchangeMode()) + { + ui.cont_confirm.selectedIndex = 0; + ui.btn_inline_ok.SetClick(() => + { + makeupTaskData.SetStatus(SaveingPotTaskStatus.ticket); + SaveData.SaveDataFunc(); + InitView(); + }); + } + else + { + ui.cont_confirm.selectedIndex = 0; + ui.type.selectedIndex = 6; + ui.text_payhint.text = "You will get the " + makeupTaskData.amountStr + " for 90 days"; + ui.text_query.text = DataMgr.ExchangeAccount.Value; + ui.btn_confirm.SetClick(() => + { + CtrlCloseUI(); + }); + } + } + else + { + ui.cont_confirm.selectedIndex = 1; + } + + var com_rank = ui.com_newRecord.com_rank; + com_rank.lab_title_des.text = GameHelper.getDesByKey("saving_pot_3"); + com_rank.lab_rank_tips.text = GameHelper.getDesByKey("saving_pot_4"); + + + + var rdVOModel = ConfigSystem.GetConfig() + .FirstOrDefault(rd => rd.id == data.tableId); + if (rdVOModel == null) return; + + if (rdVOModel.AD_Limit_times <= data.WatchVideoSpeedNum) + { + ui.btn_watch.enabled = false; + ui.btn_watch.visible = false; + com_rank.content1.selectedIndex = 1; + com_rank.text_rank1.SetVar("rank", data.WatchVideoSpeedNum.ToString()).FlushVars(); + } + else + { + ui.btn_watch.enabled = true; + ui.btn_watch.visible = true; + com_rank.content1.selectedIndex = 0; + com_rank.text_rank1.SetVar("rank", rdVOModel.AD_Down.ToString()).FlushVars(); + } + + if (rdVOModel.Login_Limit_times <= data.loginSpeedNum) + { + com_rank.content2.selectedIndex = 1; + com_rank.text_rank2.SetVar("rank", rdVOModel.Login_Limit_times.ToString()).FlushVars(); + } + else + { + com_rank.content2.selectedIndex = 0; + var loginRans = GameHelper.GetCommonModel().inlineLoginDown[0] + "-" + GameHelper.GetCommonModel().inlineLoginDown[1]; + com_rank.text_rank2.SetVar("rank", loginRans).FlushVars(); + } + + if (rdVOModel.Active_Limit_times <= data.activeSpeedNum) + { + com_rank.content3.selectedIndex = 1; + com_rank.text_rank3.SetVar("rank", rdVOModel.Active_Limit_times.ToString()).FlushVars(); + } + else + { + com_rank.content3.selectedIndex = 0; + + com_rank.text_rank3.SetVar("time", rdVOModel.Active_time.ToString()).FlushVars(); + com_rank.text_rank3.SetVar("rank", rdVOModel.Active_time_Down.ToString()).FlushVars(); + + if (CommonHelper.activeTimes_saveingpot.TryGetValue(data.tableId, out int openTimes)) + { + //Debug.Log($"openTimes ===== {openTimes}, data.tableId=== activeTimes_saveingpot_{data.tableId}"); + if (openTimes > 1) + { + //活跃的分钟数 + int min_num = ((int)Time.time - data.activeMinute) / 60; + + //是配置的活跃时间的多少倍 + int active_times = min_num / rdVOModel.Active_time; + + //Debug.Log($"min_num=== {min_num} {active_times} "); + if (active_times > 0) + { + data.activeMinute = (int)Time.time; + // 可以加速多少排名 + int rank_num = active_times * rdVOModel.Active_time_Down; + var last = data.activeSpeedNum; + if (data.activeSpeedNum > rdVOModel.Active_Limit_times) + { + // rank_num = rdVOModel.Active_Limit_times - last; + data.activeSpeedNum = rdVOModel.Active_Limit_times; + } + else + { + if (data.activeSpeedNum + rank_num > rdVOModel.Active_Limit_times) rank_num = rdVOModel.Active_Limit_times - data.activeSpeedNum; + data.activeSpeedNum += rank_num; + data.inlineNum -= rank_num; + } + + + //Debug.Log($"订单为: {data.tableId} 通过活跃时间减少的排名为:{rank_num}"); + + if (data.inlineNum < GameHelper.GetCommonModel().inlineMin) + { + data.inlineNum = GameHelper.GetCommonModel().inlineMin; + } + } + } + else + { + data.activeMinute = (int)Time.time; + } + } + } + + com_rank.text_ranks.text = data.inlineNum.ToString(); + + } + + void onTicket() + { + var vo = MakeupModel_2.GetData(makeupTaskData.tableId); + ui.type.selectedIndex = 7; + + if (makeupTaskData.rdData != null && makeupTaskData.rdData.Count > 0) + { + makeupTaskData.rdData.Sort((a, b) => + { + if (a.isClaimed == b.isClaimed) + { + return b.coupon_mount.CompareTo(a.coupon_mount); + } + else + { + return a.isClaimed ? 1 : -1; + } + }); + } + else + { + makeupTaskData.rdData = new List(); + int[] arr = ConfigSystem.GetCommonConf().PotExchange; + Array.Sort(arr, (a, b) => b.CompareTo(a)); + int remainValue = vo.item_need; + List tickets = new List(); + for (int i = 0; i < arr.Length; i++) + { + tickets.Add(remainValue / arr[i]); + remainValue = remainValue % arr[i]; + for (int j = 0; j < tickets[i]; j++) + { + SaveingPotRdData data = new SaveingPotRdData(); + data.code = GameHelper.GenerateUniqueKey1(vo,i); + data.coupon_mount = arr[i]; + data.isClaimed = false; + makeupTaskData.rdData.Add(data); + } + } + DataMgr.MakeupTaskHistory.Save(); + } + + int value = 0; + for (int i = 0; i < makeupTaskData.rdData.Count; i++) + { + if (makeupTaskData.rdData[i].isClaimed) + { + value += makeupTaskData.rdData[i].coupon_mount; + } + } + + ui.lab_mn.text = GameHelper.Get101Str(vo.item_need - value); + + ui.list_kicket.itemRenderer = refreshItem; + ui.list_kicket.numItems = makeupTaskData.rdData.Count; + } + + private void refreshItem(int index, GObject obj) + { + com_ticket_item item = (com_ticket_item)obj; + item.lab_num.text = GameHelper.GetPriceInt(makeupTaskData.rdData[index].coupon_mount); + + if (makeupTaskData.rdData[index].isClaimed) + { + item.btn_claim.state.selectedIndex = 1; + item.btn_claim.title = "Claimed"; + } + else + { + item.btn_claim.state.selectedIndex = 0; + item.btn_claim.title = "Claim"; + } + + item.btn_claim.SetClick(() => + { + makeupTaskData.SetStatus(SaveingPotTaskStatus.code); + makeupTaskData.rdData[index].isClaimed = true; + makeupTaskData.lastRdData = makeupTaskData.rdData[index]; + onCode(); + // DataMgr.ImmediateSendSave(); + DataMgr.MakeupTaskHistory.Save(); + GameDispatcher.Instance.Dispatch(GameMsg.RefreshSaveingPot); + SaveData.SaveDataFunc(); + }); + } + + void onCode() + { + if (makeupTaskData.lastRdData == null) + { + ui.type.selectedIndex = 7; + makeupTaskData.SetStatus(SaveingPotTaskStatus.ticket); + return; + } + ui.type.selectedIndex = 8; + + int value = 0; + for (int i = 0; i < makeupTaskData.rdData.Count; i++) + { + if (makeupTaskData.rdData[i].isClaimed) + { + value += makeupTaskData.rdData[i].coupon_mount; + } + } + + var vo = MakeupModel_2.GetData(makeupTaskData.tableId); + ui.lab_mn2.text = GameHelper.Get101Str(vo.item_need - value); + ui.lab_ticket.text = GameHelper.GetPriceInt(makeupTaskData.lastRdData.coupon_mount); + ui.lab_code.text = makeupTaskData.lastRdData.code; + + ui.btn_back.SetClick(() => + { + ui.type.selectedIndex = 7; + makeupTaskData.SetStatus(SaveingPotTaskStatus.ticket); + InitView(); + }); + + ui.btn_copy.SetClick(() => + { + GameHelper.CopyText(ui.lab_code.text); + }); + + ui.btn_contact_us.SetClick(() => + { + // GameHelper.OpenEmail(); + + SDKOpenConfig openConfig = new SDKOpenConfig + { + normal = false, + url = vo.C_ShopURL + }; + + + CtrlDispatcher.Instance.Dispatch(CtrlMsg.open_wb,openConfig); + + CtrlCloseUI(); + }); + + } + + private void CheckActive(int index) + { + if (CommonHelper.activeTimes_saveingpot.TryGetValue(index, out int value)) + { + value++; + // Debug.Log($"CheckActive2: {index} {value}"); + CommonHelper.activeTimes_saveingpot[index] = value; + + } + else + { + CommonHelper.activeTimes_saveingpot.Add(index, 1); + } + + } + void CheckBtnWatchStatus() + { + var data = makeupTaskData; + + if (data == null) + { + return; + } + var CardRdVOModel = ConfigSystem.GetConfig() + .FirstOrDefault(rd => rd.id == data.tableId); + if (CardRdVOModel == null) return; + + bool isShow = CardRdVOModel.AD_Limit_times > data.WatchVideoSpeedNum && data.inlineNum > GameHelper.GetCommonModel().inlineMin; + + ui.btn_watch.enabled = isShow; + + } + private void OnConfirm() + { + ui.type.selectedIndex = 3; + + Makeup_2 vo = MakeupModel_2.GetData(makeupTaskData.tableId); + if (vo == null) + { + return; + } + + // ui.text_condi1.text = GameHelper.Get101Str(vo.item_need); + // ui.pb_condi1.max = vo.item_need; + // var curValue = Math.Min(SaveData.GetSaveObject().saveingpot_ch, vo.item_need); + // ui.pb_condi1.value = (double)curValue; + // var textTitle = ui.pb_condi1.GetChild("title"); + // if (textTitle != null) + // { + // textTitle.text = GameHelper.Get102Str((decimal)curValue) + "/" + GameHelper.Get102Str(vo.item_need); + // } + + + var taskTime = (int)((float)vo.task_need / 60 * 100) * 0.01F; + // var completeTaskTime = (int)((float)makeupTaskData.H5Time / 60 * 100) * 0.01F; + // var completeTaskValue = Math.Min(completeTaskTime, taskTime); + // ui.text_condi2.text = taskTime.ToString(); + // ui.pb_condi2.max = taskTime; + // ui.pb_condi2.value = completeTaskValue; + // ui.pb_condi2.title.text = $"{completeTaskValue}/{taskTime}"; + // if (DataMgr.MakeupTaskH5Time < vo.task_need && AppConst.isPt()) + // { + // ui.show_pay.selectedIndex = com_confirm.Show_pay_true; + // } + // else ui.show_pay.selectedIndex = com_confirm.Show_pay_false; + + //ui.text_wallet.SetVar("Payer", "$").FlushVars(); + // if (AppConst.isPt()) ui.text_wallet.text = "Pix"; + ui.text_ch.text = GameHelper.Get102Str((decimal)makeupTaskData.amount); + if (!GameHelper.isRDExchangeMode()) ui.card_.visible = false; + ui.text_account.text = DataMgr.ExchangeAccount.Value; + + if (SaveData.GetSaveObject().saveingpot_ch >= vo.item_need) + { + ui.cont_confirm.selectedIndex = 0; + ui.btn_confirm.SetClick(() => + { + AudioManager.Instance.PlayDynamicEffect(AudioConst.MakeupDone); + + makeupTaskData.SetStatus(SaveingPotTaskStatus.Task); + SaveData.SaveDataFunc(); + OnTask(); + }); + } + else + { + ui.cont_confirm.selectedIndex = 1; + ui.btn_confirm.SetClick(() => + { + AudioManager.Instance.PlayDynamicEffect(AudioConst.MakeupDone); + // UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.H5UI_Open); + //GameDispatcher.Instance.Dispatch(GameMsg.MainTab, 1); + + CtrlCloseUI(); + }); + } + } + private void OnTask() + { + var vo = MakeupModel_2.GetData(makeupTaskData.tableId); + if (vo == null) + { + return; + } + ui.type.selectedIndex = 4; + ui.com_task.text_task.text = "get gift card"; + ui.com_task.text_payer.text = "{amt=$0.5} directly to your gift card"; + ui.com_task.text_orderid.text = makeupTaskData.orderID; + ui.com_task.text_task_title.SetVar("ad", vo.ad_need.ToString()).FlushVars(); + ui.com_task.text_ads.text = $"{makeupTaskData.videoCount}/{vo.ad_need}"; + ui.com_task.text_payer.SetVar("amt", makeupTaskData.GetAmountStr()).FlushVars(); + + if (makeupTaskData.videoCount >= vo.ad_need) + { + ui.com_task.cont_process.selectedIndex = 1; + ui.cont_confirm.selectedIndex = 0; + + } + else + { + ui.com_task.cont_process.selectedIndex = 0; + ui.cont_confirm.selectedIndex = 1; + } + + if (makeupTaskData.videoCount >= vo.ad_need) + { + ui.btn_confirm.state.selectedIndex = 0; + ui.btn_confirm.visible = true; + ui.btn_confirm.SetClick(() => + { + if (makeupTaskData.videoCount >= vo.ad_need) + { + GameHelper.ShowLoading(1, 2, () => + { + ConsumeSystem.Consume(vo.item, vo.item_need, isSuccess => + { + makeupTaskData.SetStatus(SaveingPotTaskStatus.Inline); + makeupTaskData.inlineInitNum = + CommonHelper.RandomRange(ConfigSystem.GetCommonConf().inlineInitNum[0], + ConfigSystem.GetCommonConf().inlineInitNum[1]); + makeupTaskData.inlineNum = CommonHelper.RandomRange( + ConfigSystem.GetCommonConf().inlineInitNum[0], + makeupTaskData.inlineInitNum); + makeupTaskData.order_time = GameHelper.GetNowTime(); + // DataMgr.MakeupTaskHistory.Save(); + //OnInline(); + SaveData.GetSaveObject().saveingpot_ch -= vo.item_need; + GameDispatcher.Instance.Dispatch(GameMsg.refreshGift); + + SaveingPotHelper.CreatSaveingPotItem(); + // Debug.Log(JsonConvert.SerializeObject(vo)); + if (vo.id == 1) + { + TrackKit.SendEvent(ADEventTrack.WithdrawEvent,ADEventTrack.Property.withdraw_cash1); + } + else if (vo.id == 2) + { + TrackKit.SendEvent(ADEventTrack.WithdrawEvent,ADEventTrack.Property.withdraw_cash2); + } + else if (vo.id == 3) + { + TrackKit.SendEvent(ADEventTrack.WithdrawEvent,ADEventTrack.Property.withdraw_cash3); + } + if (vo.id != 3) + { + // ch_index++; + } + InitView(); + + if (vo.id == 3) + { + // PlayerPrefs.SetInt("ch_lv", 2); + makeupTaskData = SaveData.GetSaveObject().saveingpot_history.Last(); + } + + }); + }); + + } + else + { + CtrlCloseUI(); + // UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.H5UI_Open); + // MainTabUI.getIns().OnGameTab(1); + } + }); + } + else + { + ui.btn_confirm.state.selectedIndex = 1; + ui.btn_confirm.visible = false; + } + + } + private void OnEnter() + { + GTextInput enter_input = null; + + enter_input = ui.com_info.enter_email; + + + ui.type.selectedIndex = 1; + ui.btn_confirm.SetClick(() => + { + var account = enter_input.text.Replace(" ", ""); + if (account == null || account == "") + { + GameHelper.ShowTips("Please enter the correct account information1", true); + return; + } + + if (!GameHelper.CheckAccountValidly(account)) + { + GameHelper.ShowTips("Please enter the correct account information2", true); + return; + } + + var fname = ui.com_fname.enter_fname.text.Replace(" ", ""); + if (!GameHelper.CheckNameValidly(fname)) + { + GameHelper.ShowTips("Please enter the correct account information3", true); + return; + } + + var lname = ui.com_lname.enter_lname.text.Replace(" ", ""); + if (!GameHelper.CheckNameValidly(lname) && !AppConst.isPt()) + { + GameHelper.ShowTips("Please enter the correct account information4", true); + return; + } + DataMgr.ExchangeAccount.Value= account; + DataMgr.ExchangeName.Value= $"{fname} {lname}"; + DataMgr.short_name = fname; + DataMgr.long_name = lname; + showPaypal(); + //uiCtrlDispatcher.Dispatch(UICtrlMsg.MakeupStepUI_Open, makeupTaskData); + //CtrlCloseUI(); + }); + + } + void showPaypal() + { + ui.type.selectedIndex = 2; + + if (makeupTaskData == null) + { + return; + } + + + ui.com_pay.text_name.text = DataMgr.ExchangeName.Value; + ui.com_pay.text_email.text = DataMgr.ExchangeAccount.Value; + + ui.com_pay.btn_change.SetClick(() => + { + DataMgr.ExchangeName.Value = null; + DataMgr.ExchangeAccount.Value = null; + OnEnter(); + + }); + + var avatarId = DataMgr.PlayerAvatarId.Value; + TextureHelper.SetAvatarToLoader(avatarId, ui.com_pay.head.GetChild("load_avatar") as GLoader); + ui.btn_confirm.SetClick(() => + { + NetApi.PayOutUserInfo(DataMgr.ExchangeAccount.Value, + DataMgr.short_name, DataMgr.long_name, (isSuccess, obj) => + { + if (isSuccess) + { + } + }); + + TrackKit.SendEvent(ADEventTrack.WithdrawEvent,ADEventTrack.Property.WithdrawMessage); + + InitView(); + }); + } + public int now_selectindex; + void initTop() + { + // Debug.Log(JsonConvert.SerializeObject(DataMgr.MakeupTaskHistory.Value)); + + List btn_list = new List() { ui.btn_level0, ui.btn_level1, ui.btn_level2 }; + + List makeup_list = ConfigSystem.GetConfig(); + now_selectindex = makeupTaskData.tableId - 1; + List saveingpot_history = SaveData.GetSaveObject().saveingpot_history; + + for (int i = 0; i < btn_list.Count; i++) + { + btn_list[i].text_ch.text = makeup_list[i].item_need + ""; + Debug.Log(makeup_list[i].item_need); + btn_list[i].index.selectedIndex = i; + if (i >= saveingpot_history.Count) + { + btn_list[i].btn_state.selectedIndex = 2; + // btn_list[i].text_type.grayed = true; + btn_list[i].text_ch.grayed = true; + } + else if (saveingpot_history.Count > i + 1 || ((saveingpot_history.Count == 3) && (saveingpot_history[2].status == SaveingPotTaskStatus.Inline))) + { + btn_list[i].btn_state.selectedIndex = 0; + } + else + { + btn_list[i].btn_state.selectedIndex = 1; + } + + + if (i == now_selectindex) + { + btn_list[i].img_outline.visible = true; + } + else if (i >= saveingpot_history.Count) + { + btn_list[i].img_outline.visible = false; + btn_list[i].SetClick(() => + { + GameHelper.ShowTips("To be unlocked"); + }); + } + else + { + btn_list[i].img_outline.visible = false; + int index = i; + btn_list[i].SetClick(() => + { + + for (int j = saveingpot_history.Count - 1; j >= 0; j--) + { + Debug.Log(saveingpot_history[j].tableId); + Debug.Log(index + 1); + Debug.Log(saveingpot_history[j].tableId == index + 1); + if (saveingpot_history[j].tableId == index + 1) + { + makeupTaskData = saveingpot_history[j]; + now_selectindex = index; + + break; + } + } + + InitView(); + }); + } + } + + } + private List config_name_list = exBrPoolModel2.config_name_list; + private List config_money_list = exBrPoolModel2.config_money_list; + private List broad_list = new List(); + private void BroadCast() + { + if (broadtime % 3 == 0) + { + ui.broad.t1.Play(() => + { + broad_list.RemoveAt(0); + int name_index = UnityEngine.Random.Range(0, config_name_list.Count); + int money_index = UnityEngine.Random.Range(0, config_money_list.Count); + broad_list.Add(new string[2] { config_name_list[name_index], config_money_list[money_index] }); + for (int i = 0; i < 4; i++) + { + if (GameHelper.isRDExchangeMode()) + { + text_list[i].text = "congratulations,[color=#ad4800][size=36] " + broad_list[i][0] + " [/size][/color]Successful exchange[color=#ad4800]" + broad_list[i][1] + "[/color]"; + } + else + { + text_list[i].text = "congratulations,[color=#ad4800][size=36] " + broad_list[i][0] + " [/size][/color]Successful exchange[color=#ad4800]$" + broad_list[i][1] + "[/color]"; + } + } + }); + + + } + + } + private List text_list = new List(); + private void InitBroadCast() + { + text_list.Add(ui.broad.rich_text0); + text_list.Add(ui.broad.rich_text1); + text_list.Add(ui.broad.rich_text2); + text_list.Add(ui.broad.rich_text3); + for (int i = 0; i < 4; i++) + { + + int name_index = UnityEngine.Random.Range(0, config_name_list.Count); + int money_index = UnityEngine.Random.Range(0, config_money_list.Count); + broad_list.Add(new string[2] { config_name_list[name_index], config_money_list[money_index] }); + if (GameHelper.isRDExchangeMode()) + { + text_list[i].text = "congratulations,[color=#ad4800][size=36] " + broad_list[i][0] + " [/size][/color]Successful exchange[color=#ad4800]" + broad_list[i][1] + "[/color]"; + } + else + { + text_list[i].text = "congratulations,[color=#ad4800][size=36] " + broad_list[i][0] + " [/size][/color]Successful exchange[color=#ad4800]$" + broad_list[i][1] + "[/color]"; + } + } + } + } +} diff --git a/Assets/Scripts/ModuleUI/SaveingPot/SaveingPotUI.cs.meta b/Assets/Scripts/ModuleUI/SaveingPot/SaveingPotUI.cs.meta new file mode 100644 index 00000000..38c4ffe4 --- /dev/null +++ b/Assets/Scripts/ModuleUI/SaveingPot/SaveingPotUI.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4f92e47328a7945b6a75b1bead2ad203 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/ModuleUI/SaveingPot/SaveingPotUICtrl.cs b/Assets/Scripts/ModuleUI/SaveingPot/SaveingPotUICtrl.cs new file mode 100644 index 00000000..4858db5c --- /dev/null +++ b/Assets/Scripts/ModuleUI/SaveingPot/SaveingPotUICtrl.cs @@ -0,0 +1,72 @@ +namespace RedHotRoast + +{ + public class SaveingPotUICtrl : BaseUICtrl + { + private SaveingPotUI ui; + private SaveingPotModel model; + + private uint openUIMsg = UICtrlMsg.SaveingPotUI_Open; + private uint closeUIMsg = UICtrlMsg.SaveingPotUI_Close; + + #region 生命周期 + protected override void OnInit() + { + //model = ModuleManager.Instance.GetModel(ModelConst.SaveingPotModel) as SaveingPotModel; + } + + protected override void OnDispose() + { + } + + public override void OpenUI(object args = null) + { + if (ui == null) + { + ui = new SaveingPotUI(this); + ui.Open(args); + } + } + + public override void CloseUI(object args = null) + { + if (ui != null && !ui.isClose) + { + ui.Close(); + } + ui = null; + } + #endregion + + #region 消息 + public override uint GetOpenUIMsg(string uiName) + { + return openUIMsg; + } + public override uint GetCloseUIMsg(string uiName) + { + return closeUIMsg; + } + + protected override void AddListener() + { + uiCtrlDispatcher.AddListener(openUIMsg, OpenUI); + uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI); + } + protected override void RemoveListener() + { + uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI); + uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI); + } + + protected override void AddServerListener() + { + + } + protected override void RemoveServerListener() + { + + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/SaveingPot/SaveingPotUICtrl.cs.meta b/Assets/Scripts/ModuleUI/SaveingPot/SaveingPotUICtrl.cs.meta new file mode 100644 index 00000000..aeb539fe --- /dev/null +++ b/Assets/Scripts/ModuleUI/SaveingPot/SaveingPotUICtrl.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dd17eb44157da4774b1a9293490c2550 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/ModuleUI/StatementView.meta b/Assets/Scripts/ModuleUI/StatementView.meta new file mode 100644 index 00000000..8f26cbe7 --- /dev/null +++ b/Assets/Scripts/ModuleUI/StatementView.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 623816ac26c74e7d995b543f35c411cf +timeCreated: 1783665325 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/StatementView/StatementViewCtrl.cs b/Assets/Scripts/ModuleUI/StatementView/StatementViewCtrl.cs new file mode 100644 index 00000000..4a8684ad --- /dev/null +++ b/Assets/Scripts/ModuleUI/StatementView/StatementViewCtrl.cs @@ -0,0 +1,42 @@ +namespace RedHotRoast +{ + public class StatementViewCtrl : BaseCtrl + { + public static StatementViewCtrl Instance { get; private set; } + + private StatementViewModel model; + + #region 生命周期 + protected override void OnInit() + { + Instance = this; + //model = ModuleManager.Instance..GetModel(ModelConst.FirstRewardModel) as FirstRewardModel; + } + + protected override void OnDispose() + { + Instance = null; + } + #endregion + + #region 消息 + protected override void AddListener() + { + + } + protected override void RemoveListener() + { + + } + + protected override void AddServerListener() + { + + } + protected override void RemoveServerListener() + { + + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/StatementView/StatementViewCtrl.cs.meta b/Assets/Scripts/ModuleUI/StatementView/StatementViewCtrl.cs.meta new file mode 100644 index 00000000..dfade209 --- /dev/null +++ b/Assets/Scripts/ModuleUI/StatementView/StatementViewCtrl.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4632715ec0e54eeea0b7d484a9b85252 +timeCreated: 1780455331 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/StatementView/StatementViewModel.cs b/Assets/Scripts/ModuleUI/StatementView/StatementViewModel.cs new file mode 100644 index 00000000..6c0abd27 --- /dev/null +++ b/Assets/Scripts/ModuleUI/StatementView/StatementViewModel.cs @@ -0,0 +1,43 @@ +namespace RedHotRoast +{ + public class StatementViewModel : BaseModel + { + #region 生命周期 + protected override void OnInit() + { + } + + protected override void OnDispose() + { + } + + // protected override void OnReset() + // { + // } + // #endregion + + // #region 读取数据 + // protected override void OnReadData() + // { + // } + // #endregion + + // #region 本地存储 + // protected override void WriteLocalStorage() + // { + + // } + #endregion + + #region 消息 + protected override void AddListener() + { + + } + protected override void RemoveListener() + { + + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/StatementView/StatementViewModel.cs.meta b/Assets/Scripts/ModuleUI/StatementView/StatementViewModel.cs.meta new file mode 100644 index 00000000..e51e8e3b --- /dev/null +++ b/Assets/Scripts/ModuleUI/StatementView/StatementViewModel.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: faf951d22aea4319860cef683fcbed35 +timeCreated: 1780455331 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/StatementView/StatementViewUI.cs b/Assets/Scripts/ModuleUI/StatementView/StatementViewUI.cs new file mode 100644 index 00000000..a2872f0b --- /dev/null +++ b/Assets/Scripts/ModuleUI/StatementView/StatementViewUI.cs @@ -0,0 +1,114 @@ +using System; +using UnityEngine; +// using FGUI.G002_main; +using Spine.Unity; +using DG.Tweening; + +namespace RedHotRoast +{ + public class StatementViewUI : BaseUI + { + private StatementViewUICtrl ctrl; + private StatementViewModel model; + private FGUI.ZM_Lobby_03.com_statement ui; + private Action closeCallback; + private Action open_sign; + private bool is_get = false; + public StatementViewUI(StatementViewUICtrl ctrl) : base(ctrl) + { + uiName = UIConst.StatementViewUI; + this.ctrl = ctrl; + } + + protected override void SetUIInfo(UIInfo uiInfo) + { + uiInfo.packageName = "ZM_Lobby_03"; + uiInfo.assetName = "com_statement"; + uiInfo.layerType = UILayerType.Popup; + uiInfo.isNeedOpenAnim = false; + uiInfo.isNeedCloseAnim = false; + uiInfo.isNeedUIMask = true; + } + + #region 生命周期 + protected override void OnInit() + { + model = ModuleManager.Instance.GetModel(ModelConst.StatementViewModel) as StatementViewModel; + } + + protected override void OnClose() + { + GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, true); + + //open_sign(); + + if (GameHelper.IsShowOpenGameUI() &&HallManager.Instance.openTipsTimes == 1) + { + UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.OpenGameUI_Open); + } + } + + protected override void OnBind() + { + ui = baseUI as FGUI.ZM_Lobby_03.com_statement; + } + + private bool need_show = false; + protected override void OnOpenBefore(object args) + { + HallManager.Instance.openTipsTimes++; + + GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, false); + + InitView(); + } + + protected override void OnOpen(object args) + { + //open_sign = (System.Action)args; + } + + protected override void OnHide() + { + } + + protected override void OnDisplay(object args) + { + } + #endregion + + #region 消息 + protected override void AddListener() + { + + } + protected override void RemoveListener() + { + + } + #endregion + + + //初始化页面逻辑 + private void InitView() + { + ui.list.scrollPane.onScrollEnd.Add(OnListScroll); + ui.btn_back.SetClick(CtrlCloseUI); + } + + private void OnListScroll() + { + var pageIndex = ui.list.scrollPane.currentPageX; + + if (pageIndex == 0) + { + ui.state1.state.selectedIndex = 1; + ui.state2.state.selectedIndex = 0; + }else if (pageIndex == 1) + { + ui.state1.state.selectedIndex = 0; + ui.state2.state.selectedIndex = 1; + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/StatementView/StatementViewUI.cs.meta b/Assets/Scripts/ModuleUI/StatementView/StatementViewUI.cs.meta new file mode 100644 index 00000000..22ea3a75 --- /dev/null +++ b/Assets/Scripts/ModuleUI/StatementView/StatementViewUI.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 65fe960a02344337a6c757d93ecf0e2e +timeCreated: 1780455331 \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/StatementView/StatementViewUICtrl.cs b/Assets/Scripts/ModuleUI/StatementView/StatementViewUICtrl.cs new file mode 100644 index 00000000..890dee14 --- /dev/null +++ b/Assets/Scripts/ModuleUI/StatementView/StatementViewUICtrl.cs @@ -0,0 +1,71 @@ +namespace RedHotRoast +{ + public class StatementViewUICtrl : BaseUICtrl + { + private StatementViewUI ui; + private StatementViewModel model; + + private uint openUIMsg = UICtrlMsg.StatementViewUI_Open; + private uint closeUIMsg = UICtrlMsg.StatementViewUI_Close; + + #region 生命周期 + protected override void OnInit() + { + //model = ModuleManager.Instance.GetModel(ModelConst.FirstRewardModel) as FirstRewardModel; + } + + protected override void OnDispose() + { + } + + public override void OpenUI(object args = null) + { + if (ui == null) + { + ui = new StatementViewUI(this); + ui.Open(args); + } + } + + public override void CloseUI(object args = null) + { + if (ui != null && !ui.isClose) + { + ui.Close(); + } + ui = null; + } + #endregion + + #region 消息 + public override uint GetOpenUIMsg(string uiName) + { + return openUIMsg; + } + public override uint GetCloseUIMsg(string uiName) + { + return closeUIMsg; + } + + protected override void AddListener() + { + uiCtrlDispatcher.AddListener(openUIMsg, OpenUI); + uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI); + } + protected override void RemoveListener() + { + uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI); + uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI); + } + + protected override void AddServerListener() + { + + } + protected override void RemoveServerListener() + { + + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/ModuleUI/StatementView/StatementViewUICtrl.cs.meta b/Assets/Scripts/ModuleUI/StatementView/StatementViewUICtrl.cs.meta new file mode 100644 index 00000000..c95598df --- /dev/null +++ b/Assets/Scripts/ModuleUI/StatementView/StatementViewUICtrl.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 8b350591ec8f41db9c3dda52f01b53c7 +timeCreated: 1780455331 \ No newline at end of file diff --git a/Assets/Scripts/Register/UIManagerRegister.cs b/Assets/Scripts/Register/UIManagerRegister.cs index 727f7fd2..f49a7e24 100644 --- a/Assets/Scripts/Register/UIManagerRegister.cs +++ b/Assets/Scripts/Register/UIManagerRegister.cs @@ -48,6 +48,10 @@ namespace RedHotRoast FGUI.LG_Unlock.LG_UnlockBinder.BindAll(); FGUI.Egg_20.Egg_20Binder.BindAll(); FGUI.ZM_H5_15.ZM_H5_15Binder.BindAll(); + FGUI.Arrow_game.Arrow_gameBinder.BindAll(); + FGUI.Arrow_Theme.Arrow_ThemeBinder.BindAll(); + FGUI.ZM_Petty.ZM_PettyBinder.BindAll(); + FGUI.tixian.tixianBinder.BindAll(); } public static void AutoRegisterCommonPackages() diff --git a/Assets/Scripts/SaveingPotClass.cs b/Assets/Scripts/SaveingPotClass.cs index cca7738a..0d841b50 100644 --- a/Assets/Scripts/SaveingPotClass.cs +++ b/Assets/Scripts/SaveingPotClass.cs @@ -1,169 +1,179 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using RedHotRoast; -using UnityEngine; - -public class SaveingPotClass -{ - - public int tableId; - - - public int id; - - - public string amountStr; - - - public float amount; - - - public long makeupTime; - - - public int videoCount; - - - public int inlineInitNum; - - - public int inlineNum; - - - public string orderID; - - - public SaveingPotTaskStatus status; - - public long order_time = 0; - public int WatchVideoSpeedNum = 0; - public int loginSpeedNum = 0; - public int activeMinute = 0; - public int activeSpeedNum = 0; - - public bool needShowAni = true; - public float H5Time; - - public long clear_time; - public long start_time; - public bool auto_show = false; - public void SetStatus(SaveingPotTaskStatus _status) - { - status = _status; - } - - public string GetAmountStr() - { - // if (amount <= 0) - // { - // return amountStr; - // } - // else - // { - return GameHelper.ChooseCurrency() + $"{amount:N}"; - //} - } - - public float ch_number = 0; -} -public enum SaveingPotTaskStatus -{ - None, - Task, - Inline, -} -// var makeupTaskData = new MakeupTaskData(); -// makeupTaskData.tableId = makeupVo.id; -// makeupTaskData.id = DataMgr.MakeupTaskHistory.Value.Count + 1; -// makeupTaskData.amountStr = $"{GameHelper.Get102Str(makeupVo.item_need)}"; -// makeupTaskData.amount = makeupVo.item_need; -// makeupTaskData.orderID = GameHelper.GetRandomNum(8); - -// DataMgr.MakeupTaskHistory.Value.Add(makeupTaskData); -// Debug.Log("uuuuuuuuuuuuuuuuuuuu"); -// makeupTaskData.SetStatus(MakeupTaskStatus.None); -public class SaveingPotHelper -{ - - public static void CheckSaveingPot() - { - Debug.Log(SaveData.GetSaveObject()); - if (SaveData.GetSaveObject().saveingpot_history == null || SaveData.GetSaveObject().saveingpot_history.Count == 0) - { - CreatSaveingPotItem(); - } - ResetHistory(); - } - - public static void CreatSaveingPotItem() - { - if (SaveData.GetSaveObject().saveingpot_history.Count >= 3) - { - SaveData.SaveDataFunc(); - return; - } - int index = SaveData.GetSaveObject().saveingpot_history.Count; - if (index >= ConfigSystem.GetConfig().Count) index = ConfigSystem.GetConfig().Count - 1; - Makeup_2 config = ConfigSystem.GetConfig()[index]; - SaveingPotClass saveingpot = new SaveingPotClass(); - saveingpot.tableId = config.id; - saveingpot.id = SaveData.GetSaveObject().saveingpot_history.Count + 1; - saveingpot.amountStr = GameHelper.ChooseCurrency() + $"{config.item_need:N}"; - saveingpot.amount = config.item_need; - saveingpot.orderID = GameHelper.GetRandomNum(8); - saveingpot.SetStatus(SaveingPotTaskStatus.None); - saveingpot.clear_time = GameHelper.GetNowTime() + config.Reset_time * 3600; - saveingpot.start_time = GameHelper.GetNowTime(); - - SaveData.GetSaveObject().saveingpot_history.Add(saveingpot); - SaveData.SaveDataFunc(); - Debug.Log("zengjaichenggong"); - } - - public static bool TestingClearTime() - { - if (SaveData.GetSaveObject().saveingpot_history[SaveData.GetSaveObject().saveingpot_history.Count - 1].clear_time < GameHelper.GetNowTime() && SaveData.GetSaveObject().saveingpot_history[SaveData.GetSaveObject().saveingpot_history.Count - 1].needShowAni) - { - Debug.Log("qinglisaveingpot"); - int index = SaveData.GetSaveObject().saveingpot_history.Count - 1; - Makeup_2 config = ConfigSystem.GetConfig()[index]; - SaveData.GetSaveObject().saveingpot_ch = 0; - SaveData.GetSaveObject().saveingpot_history[SaveData.GetSaveObject().saveingpot_history.Count - 1].clear_time = GameHelper.GetNowTime() + config.Reset_time * 3600; - SaveData.GetSaveObject().saveingpot_history[SaveData.GetSaveObject().saveingpot_history.Count - 1].auto_show = false; - - return true; - - } - return false; - } - public static void ResetHistory() - { - for (int i = 0; i < SaveData.GetSaveObject().saveingpot_history.Count; i++) - { - SaveingPotClass saveingpot = SaveData.GetSaveObject().saveingpot_history[i]; - Makeup_2 config = ConfigSystem.GetConfig()[i]; - saveingpot.amount = config.item_need; - saveingpot.amountStr = GameHelper.ChooseCurrency() + $"{config.item_need:N}"; - if (saveingpot.start_time + config.Reset_time * 3600 - saveingpot.clear_time > 100) - { - saveingpot.clear_time = saveingpot.start_time + config.Reset_time * 3600; - } - } - SaveData.SaveDataFunc(); - - } - - - - public static string getChString(float ch) - { - return GameHelper.ChooseCurrency()+$"{ch:N}"; - } - public static string getChNumber(float ch) - { - return $"{ch:N}"; - } - -} - +using System.Collections.Generic; +using RedHotRoast; +using IgnoreOPS; +using UnityEngine; + +public class SaveingPotClass +{ + + public int tableId; + + + public int id; + + + public string amountStr; + + + public float amount; + + + public long makeupTime; + + + public int videoCount; + + + public int inlineInitNum; + + + public int inlineNum; + + + public string orderID; + + + public SaveingPotTaskStatus status; + + public long order_time = 0; + public int WatchVideoSpeedNum = 0; + public int loginSpeedNum = 0; + public int activeMinute = 0; + public int activeSpeedNum = 0; + + public bool needShowAni = true; + public float H5Time; + + public long clear_time; + public long start_time; + public bool auto_show; + public List rdData; + public SaveingPotRdData lastRdData; + + public void SetStatus(SaveingPotTaskStatus _status) + { + status = _status; + } + + public string GetAmountStr() + { + // if (amount <= 0) + // { + // return amountStr; + // } + // else + // { + return $"{amount:N}"; + //} + } + + public float cash_number = 0; +} +public enum SaveingPotTaskStatus +{ + None, + Task, + Inline, + ticket, + code, +} +public class SaveingPotRdData +{ + public int coupon_mount; + public string code; + public bool isClaimed; +} +// var makeupTaskData = new MakeupTaskData(); +// makeupTaskData.tableId = makeupVo.id; +// makeupTaskData.id = DataMgr.MakeupTaskHistory.Value.Count + 1; +// makeupTaskData.amountStr = $"{GameHelper.Get102Str(makeupVo.item_need)}"; +// makeupTaskData.amount = makeupVo.item_need; +// makeupTaskData.orderID = GameHelper.GetRandomNum(8); + +// DataMgr.MakeupTaskHistory.Value.Add(makeupTaskData); +// Debug.Log("uuuuuuuuuuuuuuuuuuuu"); +// makeupTaskData.SetStatus(MakeupTaskStatus.None); +public class SaveingPotHelper +{ + + public static void CheckSaveingPot() + { + Debug.Log(SaveData.GetSaveObject()); + if (SaveData.GetSaveObject().saveingpot_history == null || SaveData.GetSaveObject().saveingpot_history.Count == 0) + { + CreatSaveingPotItem(); + } + ResetHistory(); + } + + public static void CreatSaveingPotItem() + { + if (SaveData.GetSaveObject().saveingpot_history.Count >= 3) + { + SaveData.SaveDataFunc(); + return; + } + int index = SaveData.GetSaveObject().saveingpot_history.Count; + if (index >= ConfigSystem.GetConfig().Count) index = ConfigSystem.GetConfig().Count - 1; + Makeup_2 config = ConfigSystem.GetConfig()[index]; + SaveingPotClass saveingpot = new SaveingPotClass(); + saveingpot.tableId = config.id; + saveingpot.id = SaveData.GetSaveObject().saveingpot_history.Count + 1; + saveingpot.amountStr = $"${config.item_need:N}"; + saveingpot.amount = config.item_need; + saveingpot.orderID = GameHelper.GetRandomNum(8); + saveingpot.SetStatus(SaveingPotTaskStatus.None); + saveingpot.clear_time = GameHelper.GetNowTime() + config.Reset_time * 3600; + saveingpot.start_time = GameHelper.GetNowTime(); + + SaveData.GetSaveObject().saveingpot_history.Add(saveingpot); + SaveData.SaveDataFunc(); + Debug.Log("zengjaichenggong"); + } + + public static bool TestingClearTime() + { + if (SaveData.GetSaveObject().saveingpot_history[SaveData.GetSaveObject().saveingpot_history.Count - 1].clear_time < GameHelper.GetNowTime() && SaveData.GetSaveObject().saveingpot_history[SaveData.GetSaveObject().saveingpot_history.Count - 1].needShowAni) + { + Debug.Log("qinglisaveingpot"); + int index = SaveData.GetSaveObject().saveingpot_history.Count - 1; + Makeup_2 config = ConfigSystem.GetConfig()[index]; + SaveData.GetSaveObject().saveingpot_ch = 0; + SaveData.GetSaveObject().saveingpot_history[SaveData.GetSaveObject().saveingpot_history.Count - 1].clear_time = GameHelper.GetNowTime() + config.Reset_time * 3600; + SaveData.GetSaveObject().saveingpot_history[SaveData.GetSaveObject().saveingpot_history.Count - 1].auto_show = false; + + return true; + + } + return false; + } + public static void ResetHistory() + { + for (int i = 0; i < SaveData.GetSaveObject().saveingpot_history.Count; i++) + { + SaveingPotClass saveingpot = SaveData.GetSaveObject().saveingpot_history[i]; + Makeup_2 config = ConfigSystem.GetConfig()[i]; + saveingpot.amount = config.item_need; + saveingpot.amountStr = $"${config.item_need:N}"; + if (saveingpot.start_time + config.Reset_time * 3600 - saveingpot.clear_time > 100) + { + saveingpot.clear_time = saveingpot.start_time + config.Reset_time * 3600; + } + } + SaveData.SaveDataFunc(); + + } + + + + public static string getChString(float cash) + { + return $"${cash:N}"; + } + public static string getChNumber(float cash) + { + return $"{cash:N}"; + } + +} + diff --git a/Assets/Scripts/TrackData.cs b/Assets/Scripts/TrackData.cs index 423c1316..ec16ccee 100644 --- a/Assets/Scripts/TrackData.cs +++ b/Assets/Scripts/TrackData.cs @@ -16,6 +16,8 @@ public static class ADEventTrack public static readonly string VipLive = TrackEvent.Register("vip_live"); public static readonly string VipSecretAlbums = TrackEvent.Register("vip_secret_albums"); public static readonly string Coinsbuy = TrackEvent.Register("coins_buy"); + public static readonly string WithdrawEvent = TrackEvent.Register("withdraw_behavior"); + public static class Property { #region +1盒子 @@ -154,7 +156,14 @@ public static class ADEventTrack public static readonly string WatchAdNumber = TrackProperty.Register("WatchAdNumber"); public static readonly string FinishAdNumber = TrackProperty.Register("FinishAdNumber"); - + public static readonly string WithdrawMessage = TrackProperty.Register("WithdrawMessage"); + public static readonly string WithdrawCash = TrackProperty.Register("WithdrawCash"); + + #region 储钱罐 + public static readonly string withdraw_cash1 = TrackProperty.Register("withdraw_cash1"); + public static readonly string withdraw_cash2 = TrackProperty.Register("withdraw_cash2"); + public static readonly string withdraw_cash3 = TrackProperty.Register("withdraw_cash3"); + #endregion } } diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index ed955eba..ec42b529 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -898,7 +898,7 @@ PlayerSettings: WebGL: UNITY_VISUAL_SCRIPTING;ES3_TMPRO;ES3_UGUI Windows Store Apps: UNITY_VISUAL_SCRIPTING;ES3_TMPRO;ES3_UGUI XboxOne: UNITY_VISUAL_SCRIPTING;ES3_TMPRO;ES3_UGUI - iPhone: MAX;GAME_RELEASE;UNITY_VISUAL_SCRIPTING;ES3_TMPRO;ES3_UGUI;USE_ADDRESSABLES;UNITY_IAP;UNITY_PURCHASING + iPhone: MAX;GAME_RELEASE1;UNITY_VISUAL_SCRIPTING;ES3_TMPRO;ES3_UGUI;USE_ADDRESSABLES;UNITY_IAP;UNITY_PURCHASING tvOS: UNITY_VISUAL_SCRIPTING;ES3_TMPRO;ES3_UGUI additionalCompilerArguments: {} platformArchitecture: {}