FashionShowEditPage.cs 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class FashionShowEditPage : Regist
  6. {
  7. #region Config
  8. //StartMark-Used by LabelUtility-Do not remove
  9. private static Text CoinText;
  10. private static Text DiamondText;
  11. private static Text RecommendTitle;
  12. private static Text PraiseText;
  13. //private static Text FashionTitle;
  14. //private static Text FashionContent;
  15. private static Text CuteTitle;
  16. private static Text CuteValue;
  17. private static Text CuteRateText;
  18. private static Text GraceTitle;
  19. private static Text GraceValue;
  20. private static Text GraceRateText;
  21. private static Text VividTitle;
  22. private static Text VividValue;
  23. private static Text VividRateText;
  24. private static Text SimpleTitle;
  25. private static Text SimpleValue;
  26. private static Text SimpleRateText;
  27. private static Text GloryTitle;
  28. private static Text GloryValue;
  29. private static Text GloryRateText;
  30. private static Text FashionShowClosesTitle;
  31. private static Text CloseTotalCoinText;
  32. private static Text CloseTotalDiamondText;
  33. private static Button Return;
  34. private static Button DisplayEditButton;
  35. private static Button DeleteButton;
  36. private static Button ResetButton;
  37. private static Button SaveButton;
  38. private static Button PraiseButton;
  39. private static Button CommentButton;
  40. private static Button ShareButton;
  41. private static Button FashionTitleEditButton;
  42. private static Button FashionContentEditButton;
  43. private static Button RateButton;
  44. //EndMark-Used by LabelUtility-Do not remove
  45. private static Button SubmitRateButton;
  46. private static Button ResetRateButton;
  47. private static TweenOutline rateButtonAnim;
  48. private static Button DressroomFashionShowButton;
  49. private static Transform GardenFashionShowButtonParent;
  50. private static Text BuyAllButtonText;
  51. private static Button BuyAllButton;
  52. private static Transform Panel;
  53. private static Transform ChangeDressPanel;
  54. private static Transform DisplayBackground;
  55. private static Transform CuteRateBackground;
  56. private static Transform GraceRateBackground;
  57. private static Transform VividRateBackground;
  58. private static Transform SimpleRateBackground;
  59. private static Transform GloryRateBackground;
  60. private static Transform FashionShowCloseGrid;
  61. private static InputField FashionTitleInputField;
  62. private static InputField FashionContentInputField;
  63. private static CustomSlider CuteSlider;
  64. private static CustomSlider GraceSlider;
  65. private static CustomSlider VividSlider;
  66. private static CustomSlider SimpleSlider;
  67. private static CustomSlider GlorySlider;
  68. private static Transform CuteSliderBg;
  69. private static Transform GraceSliderBg;
  70. private static Transform VividSliderBg;
  71. private static Transform SimpleSliderBg;
  72. private static Transform GlorySliderBg;
  73. //private static bool Praised;
  74. private static bool BelongSelf;
  75. private static bool LeaveToRateMode;
  76. public static bool LeaveToHomePage;
  77. public static Player DisplayPlayer;
  78. private static KV<int, double> TotalCoin;
  79. private static KV<int, double> TotalDiamond;
  80. private static TweenRenderer PlayerTween;
  81. private static GetFashionShowData FashionShowData;
  82. private static List<int> CloseIDs = new List<int>();
  83. //private static List<string> CloseNames = new List<string>();
  84. private static List<FashionShowCloseItem> CloseItems = new List<FashionShowCloseItem>();
  85. private static int UnlockLevel = 21;
  86. #endregion
  87. public override void RegistReference()
  88. {
  89. CoinText = ResourceManager.Get<Text>(CanvasLabel.Pg_CoinText);
  90. DiamondText = ResourceManager.Get<Text>(CanvasLabel.Pg_DiamondText);
  91. RecommendTitle = ResourceManager.Get<Text>(CanvasLabel.Pg_RecommendTitle);
  92. PraiseText = ResourceManager.Get<Text>(CanvasLabel.Pg_PraiseText);
  93. //FashionTitle = ResourceManager.Get<Text>(CanvasLabel.Pg_FashionTitle);
  94. //FashionContent = ResourceManager.Get<Text>(CanvasLabel.Pg_FashionContent);
  95. CuteTitle = ResourceManager.Get<Text>(CanvasLabel.Pg_CuteTitle);
  96. CuteValue = ResourceManager.Get<Text>(CanvasLabel.Pg_CuteValue);
  97. CuteRateText = ResourceManager.Get<Text>(CanvasLabel.Pg_CuteRateText);
  98. GraceTitle = ResourceManager.Get<Text>(CanvasLabel.Pg_GraceTitle);
  99. GraceValue = ResourceManager.Get<Text>(CanvasLabel.Pg_GraceValue);
  100. GraceRateText = ResourceManager.Get<Text>(CanvasLabel.Pg_GraceRateText);
  101. VividTitle = ResourceManager.Get<Text>(CanvasLabel.Pg_VividTitle);
  102. VividValue = ResourceManager.Get<Text>(CanvasLabel.Pg_VividValue);
  103. VividRateText = ResourceManager.Get<Text>(CanvasLabel.Pg_VividRateText);
  104. SimpleTitle = ResourceManager.Get<Text>(CanvasLabel.Pg_SimpleTitle);
  105. SimpleValue = ResourceManager.Get<Text>(CanvasLabel.Pg_SimpleValue);
  106. SimpleRateText = ResourceManager.Get<Text>(CanvasLabel.Pg_SimpleRateText);
  107. GloryTitle = ResourceManager.Get<Text>(CanvasLabel.Pg_GloryTitle);
  108. GloryValue = ResourceManager.Get<Text>(CanvasLabel.Pg_GloryValue);
  109. GloryRateText = ResourceManager.Get<Text>(CanvasLabel.Pg_GloryRateText);
  110. FashionShowClosesTitle = ResourceManager.Get<Text>(CanvasLabel.Pg_FashionShowClosesTitle);
  111. CloseTotalCoinText = ResourceManager.Get<Text>(CanvasLabel.Pg_CloseTotalCoinText);
  112. CloseTotalDiamondText = ResourceManager.Get<Text>(CanvasLabel.Pg_CloseTotalDiamondText);
  113. CuteSlider = ResourceManager.Get<CustomSlider>(CanvasLabel.Pg_CuteSlider);
  114. GraceSlider = ResourceManager.Get<CustomSlider>(CanvasLabel.Pg_GraceSlider);
  115. VividSlider = ResourceManager.Get<CustomSlider>(CanvasLabel.Pg_VividSlider);
  116. SimpleSlider = ResourceManager.Get<CustomSlider>(CanvasLabel.Pg_SimpleSlider);
  117. GlorySlider = ResourceManager.Get<CustomSlider>(CanvasLabel.Pg_GlorySlider);
  118. CuteSliderBg = ResourceManager.Get(CanvasLabel.Pg_CuteBackground);
  119. GraceSliderBg = ResourceManager.Get(CanvasLabel.Pg_GraceBackground);
  120. VividSliderBg = ResourceManager.Get(CanvasLabel.Pg_VividBackground);
  121. SimpleSliderBg = ResourceManager.Get(CanvasLabel.Pg_SimpleBackground);
  122. GlorySliderBg = ResourceManager.Get(CanvasLabel.Pg_GloryBackground);
  123. Return = ResourceManager.Get<Button>(CanvasLabel.Pg_Return);
  124. DisplayEditButton = ResourceManager.Get<Button>(CanvasLabel.Pg_DisplayEditButton);
  125. DeleteButton = ResourceManager.Get<Button>(CanvasLabel.Pg_DeleteButton);
  126. ResetButton = ResourceManager.Get<Button>(CanvasLabel.Pg_ResetButton);
  127. SaveButton = ResourceManager.Get<Button>(CanvasLabel.Pg_SaveButton);
  128. PraiseButton = ResourceManager.Get<Button>(CanvasLabel.Pg_PraiseButton);
  129. CommentButton = ResourceManager.Get<Button>(CanvasLabel.Pg_CommentButton);
  130. ShareButton = ResourceManager.Get<Button>(CanvasLabel.Pg_ShareButton);
  131. FashionTitleEditButton = ResourceManager.Get<Button>(CanvasLabel.Pg_FashionTitleEditButton);
  132. FashionContentEditButton = ResourceManager.Get<Button>(CanvasLabel.Pg_FashionContentEditButton);
  133. RateButton = ResourceManager.Get<Button>(CanvasLabel.Pg_RateButton);
  134. SubmitRateButton = ResourceManager.Get<Button>(CanvasLabel.Pg_SubmitRateButton);
  135. ResetRateButton = ResourceManager.Get<Button>(CanvasLabel.Pg_ResetRateButton);
  136. DressroomFashionShowButton = ResourceManager.Get<Button>(CanvasLabel.P_FashionShowButton);
  137. GardenFashionShowButtonParent = ResourceManager.Get(CanvasLabel.C_FashionShowButtonParent);
  138. BuyAllButtonText = ResourceManager.Get<Text>(CanvasLabel.Pg_BuyAllButtonText);
  139. BuyAllButton= ResourceManager.Get<Button>(CanvasLabel.Pg_BuyAllButton);
  140. Panel = ResourceManager.Get(CanvasLabel.Pg_FashionShowEditPanel);
  141. ChangeDressPanel = ResourceManager.Get(CanvasLabel.P_ChangeDressPanel);
  142. DisplayBackground = ResourceManager.Get(CanvasLabel.Pg_DisplayBackground);
  143. CuteRateBackground = ResourceManager.Get(CanvasLabel.Pg_CuteRateBackground);
  144. GraceRateBackground = ResourceManager.Get(CanvasLabel.Pg_GraceRateBackground);
  145. VividRateBackground = ResourceManager.Get(CanvasLabel.Pg_VividRateBackground);
  146. SimpleRateBackground = ResourceManager.Get(CanvasLabel.Pg_SimpleRateBackground);
  147. GloryRateBackground = ResourceManager.Get(CanvasLabel.Pg_GloryRateBackground);
  148. FashionShowCloseGrid = ResourceManager.Get(CanvasLabel.Pg_FashionShowCloseGrid);
  149. FashionTitleInputField = ResourceManager.Get<InputField>(CanvasLabel.Pg_FashionTitleBackground);
  150. FashionContentInputField = ResourceManager.Get<InputField>(CanvasLabel.Pg_FashionContentBackground);
  151. LanguageManager.Add(BuyAllButtonText, new MulLanStr(LanguageLabel.UI__Pg_BuyAll));
  152. LanguageManager.Add(CuteTitle, new MulLanStr(LanguageLabel.UI__Pg_Cute));
  153. LanguageManager.Add(GraceTitle, new MulLanStr(LanguageLabel.UI__Pg_Grace));
  154. LanguageManager.Add(SimpleTitle, new MulLanStr(LanguageLabel.UI__Pg_Simple));
  155. LanguageManager.Add(VividTitle, new MulLanStr(LanguageLabel.UI__Pg_Vivid));
  156. LanguageManager.Add(GloryTitle, new MulLanStr(LanguageLabel.UI__Pg_Glory));
  157. LanguageManager.Add(FashionShowClosesTitle, new MulLanStr(LanguageLabel.UI__Pg_CloseGridTitle));
  158. Panel.CreateTweenVec2D(ResourceManager.Get(CanvasLabel.Pg_FashionShowEditPanelPosition).position, 0.5f, false, false, true, Curve.EaseOutQuad);
  159. ChangeDressPanel.CreateTweenCG(0, 1, 0.25f, false, true, Curve.EaseOutQuad);
  160. CuteSlider.onValueChanged.AddListener(OnCuteSliderValueChange);
  161. CuteSlider.onPointerDown += OnCuteSliderSelect;
  162. CuteSlider.onPointerUp += OnCuteSliderDeselect;
  163. GraceSlider.onValueChanged.AddListener(OnGraceSliderValueChange);
  164. GraceSlider.onPointerDown += OnGraceSliderSelect;
  165. GraceSlider.onPointerUp += OnGraceSliderDeselect;
  166. SimpleSlider.onValueChanged.AddListener(OnSimpleSliderValueChange);
  167. SimpleSlider.onPointerDown += OnSimpleSliderSelect;
  168. SimpleSlider.onPointerUp += OnSimpleSliderDeselect;
  169. GlorySlider.onValueChanged.AddListener(OnGlorySliderValueChange);
  170. GlorySlider.onPointerDown += OnGlorySliderSelect;
  171. GlorySlider.onPointerUp += OnGlorySliderDeselect;
  172. VividSlider.onValueChanged.AddListener(OnVividSliderValueChange);
  173. VividSlider.onPointerDown += OnVividSliderSelect;
  174. VividSlider.onPointerUp += OnVividSliderDeselect;
  175. Return.onClick.AddListener(OnReturnButtonClick);
  176. CommentButton.onClick.AddListener(OnCommentButtonClick);
  177. PraiseButton.onClick.AddListener(OnPraiseButtonClick);
  178. ShareButton.onClick.AddListener(OnShareButtonClick);
  179. DisplayEditButton.onClick.AddListener(OnDisplayEditButtonClick);
  180. RateButton.onClick.AddListener(OnRateButtonClick);
  181. SubmitRateButton.onClick.AddListener(OnSubmitRateClick);
  182. ResetRateButton.onClick.AddListener(OnResetRateClick);
  183. SaveButton.onClick.AddListener(OnSaveButtonClick);
  184. ResetButton.onClick.AddListener(OnResetButtonClick);
  185. DeleteButton.onClick.AddListener(OnDeleteButtonClick);
  186. BuyAllButton.onClick.AddListener(OnBuyAllButtonClick);
  187. DressroomFashionShowButton.onClick.AddListener(OnDressroomFashionShowButtonClick);
  188. Manager.OnLevelChange += OnLevelChange;
  189. Manager.OnCoinChange += amt => { CoinText.text = ResourceManager.Get<Text>(CanvasLabel.F_CoinLab).text; };
  190. Manager.OnDiamondChange += amt => { DiamondText.text = ResourceManager.Get<Text>(CanvasLabel.F_DiamondLab).text; };
  191. Outline outline = RateButton.GetComponent<Outline>();
  192. Color originColor = outline.effectColor;
  193. Color destColor = outline.effectColor;
  194. destColor.a = 0;
  195. rateButtonAnim = new TweenOutline(outline, originColor, destColor, 0.5f, true, true, Curve.EaseOutQuad);
  196. rateButtonAnim.OnForwardFinish += () => rateButtonAnim.StartBackward();
  197. rateButtonAnim.OnBackwardFinish += () => rateButtonAnim.StartForward();
  198. rateButtonAnim.StartForward();
  199. rateButtonAnim.Pause();
  200. }
  201. public static void ShowEditPanel(GetFashionShowData data)
  202. {
  203. BelongSelf = true;
  204. FashionShowData = data;
  205. CloseIDs = data.GetCloseIds();
  206. //CloseNames = Player.DressIDToDressName(data.CloseIDs); ;
  207. TransitPanel();
  208. ShowPanel();
  209. EnterEditMode();
  210. }
  211. public static void ShowRatePanel(bool belongSelf, GetFashionShowData data)
  212. {
  213. BelongSelf = belongSelf;
  214. FashionShowData = data;
  215. CloseIDs = data.GetCloseIds();
  216. //CloseNames = Player.DressIDToDressName(data.CloseIDs); ;
  217. Panel.TweenForVec();
  218. ShowPanel();
  219. EnterRateMode();
  220. }
  221. private static void ShowPanel()
  222. {
  223. DisplayPlayer = PlayerManager.Instance.GetRawPlayer();
  224. DisplayPlayer.transform.SetParent(DisplayBackground);
  225. DisplayPlayer.transform.SetSiblingIndex(1);
  226. DisplayPlayer.transform.localPosition = Vector3.zero;
  227. foreach (var closeID in CloseIDs)
  228. {
  229. CloseItem closeItem = PlayerManager.CloseItemDictionary[closeID];
  230. closeItem.ChangeDress(DisplayPlayer, false);
  231. }
  232. DelayCall.Call(1, () => { DisplayPlayer.ResetDepth(); DisplayPlayer.DisplayInUI(37.5f); });
  233. float cuteRate = FashionShowData.GetCuteRate();
  234. float gloryRate = FashionShowData.GetGloryRate();
  235. float graceRate = FashionShowData.GetGraceRate();
  236. float simpleRate = FashionShowData.GetSimpleRate();
  237. float vividRate = FashionShowData.GetVividRate();
  238. CuteSlider.value = cuteRate == 0 ? 1 : cuteRate;
  239. GlorySlider.value = cuteRate == 0 ? 1 : gloryRate;
  240. GraceSlider.value = cuteRate == 0 ? 1 : graceRate;
  241. SimpleSlider.value = cuteRate == 0 ? 1 : simpleRate;
  242. VividSlider.value = cuteRate == 0 ? 1 : vividRate;
  243. ShowRateValue();
  244. FashionTitleInputField.text = FashionShowData.title;
  245. FashionContentInputField.text = FashionShowData.content;
  246. RecommendTitle.text = Language.GetStr(LanguageLabel.UI__Pg_RecommendTitle).Replace(TransferLabel.Value, FashionShowData.playerNickName);
  247. HideRateButton();
  248. DisableRatePanel();
  249. for (int i = 0; i < CloseItems.Count; i++)
  250. {
  251. ResourceManager.Save(CloseItems[i].Transform);
  252. }
  253. CloseItems = new List<FashionShowCloseItem>();
  254. foreach (var closeID in CloseIDs)
  255. {
  256. if (PlayerManager.CloseItemDictionary[closeID].Sprites == null) continue;
  257. if (PlayerManager.CloseItemDictionary[closeID].ArmatureName == "Empty") continue;
  258. Transform itemTrans = ResourceManager.Get(ResourceLabel.FashionShowCloseItem, Folder.UI, false, FashionShowCloseGrid, false, ObjType.FashionShowCloseItem);
  259. FashionShowCloseItem item = new FashionShowCloseItem();
  260. item.Init(closeID, itemTrans);
  261. CloseItems.Add(item);
  262. }
  263. }
  264. private static void ShowRateValue()
  265. {
  266. CuteSlider.value = 3;
  267. GlorySlider.value = 3;
  268. GraceSlider.value = 3;
  269. SimpleSlider.value = 3;
  270. VividSlider.value = 3;
  271. CuteValue.text = FashionShowData.cuteScore == 0 ? "--" : FashionShowData.GetCuteRate().ToString("0.0");
  272. GloryValue.text = FashionShowData.gloryScore == 0 ? "--" : FashionShowData.GetGloryRate().ToString("0.0");
  273. GraceValue.text = FashionShowData.graceScore == 0 ? "--" : FashionShowData.GetGraceRate().ToString("0.0");
  274. SimpleValue.text = FashionShowData.simpleScore == 0 ? "--" : FashionShowData.GetSimpleRate().ToString("0.0");
  275. VividValue.text = FashionShowData.vividScore == 0 ? "--" : FashionShowData.GetVividRate().ToString("0.0");
  276. }
  277. private static void TransitPanel()
  278. {
  279. Renderer renderer = PlayerManager.Player.HeadSlot.UnityTransform.GetComponentInChildren<Renderer>(true);
  280. PlayerTween = AnimManager.CreateTweenRenderer(renderer, 0, 1, 0.25f, false, true, Curve.EaseOutQuad);
  281. PlayerTween.UseSharedMaterial = true;
  282. PlayerTween.StartBackward();
  283. ChangeDressPanel.GetTweenCG().AddEventOnetime(EventType.BackwardFinish, () => { Panel.TweenForVec(); });
  284. ChangeDressPanel.TweenBacCG();
  285. }
  286. private static void EnterEditMode()
  287. {
  288. FashionTitleInputField.interactable = true;
  289. FashionContentInputField.interactable = true;
  290. if (FashionShowData.showId == -1)
  291. {
  292. DeleteButton.SetActive(false);
  293. }
  294. else
  295. {
  296. DeleteButton.SetActive(true);
  297. }
  298. SaveButton.SetActive(true);
  299. ResetButton.SetActive(true);
  300. PraiseButton.SetActive(false);
  301. ShareButton.SetActive(false);
  302. CommentButton.SetActive(false);
  303. DisplayEditButton.SetActive(false);
  304. FashionTitleEditButton.SetActive(true);
  305. FashionContentEditButton.SetActive(true);
  306. FashionTitleInputField.SetActive(true);
  307. FashionContentInputField.SetActive(true);
  308. BuyAllButton.SetActive(false);
  309. foreach (var closeItem in CloseItems)
  310. {
  311. closeItem.BoxButton.interactable = false;
  312. closeItem.Text.SetActive(false);
  313. }
  314. UpdateTotalCost(false);
  315. }
  316. private static void EnterRateMode()
  317. {
  318. FashionTitleInputField.interactable = false;
  319. FashionContentInputField.interactable = false;
  320. DeleteButton.SetActive(false);
  321. SaveButton.SetActive(false);
  322. ResetButton.SetActive(false);
  323. PraiseButton.SetActive(true);
  324. RefreshPraiseButton();
  325. ShareButton.SetActive(true);
  326. CommentButton.SetActive(true);
  327. DisplayEditButton.SetActive(BelongSelf);
  328. FashionTitleEditButton.SetActive(false);
  329. FashionContentEditButton.SetActive(false);
  330. FashionTitleInputField.SetActive(false);
  331. FashionContentInputField.SetActive(false);
  332. ShowRateButton();
  333. bool haveUnboughtClose = false;
  334. foreach (var closeItem in CloseItems)
  335. {
  336. if (closeItem.CloseItem.IsBought)
  337. {
  338. closeItem.Text.SetActive(true);
  339. }
  340. else
  341. {
  342. closeItem.Text.SetActive(false);
  343. closeItem.BoxButton.interactable = true;
  344. haveUnboughtClose = true;
  345. }
  346. }
  347. BuyAllButton.SetActive(haveUnboughtClose);
  348. UpdateTotalCost(true);
  349. }
  350. public static void HidePanel()
  351. {
  352. if (LeaveToRateMode)
  353. {
  354. EnterRateMode();
  355. LeaveToRateMode = false;
  356. }
  357. else if (LeaveToHomePage)
  358. {
  359. DisplayPlayer.DisplayInScene();
  360. ResourceManager.Save(DisplayPlayer);
  361. Panel.GetTweenVec().AddEventOnetime(EventType.BackwardFinish, () => { FashionShowHomePage.ShowSidePanel(); });
  362. Panel.TweenBacVec();
  363. LeaveToHomePage = false;
  364. }
  365. else
  366. {
  367. DisplayPlayer.DisplayInScene();
  368. ResourceManager.Save(DisplayPlayer);
  369. PlayerTween.StartForward();
  370. Panel.GetTweenVec().AddEventOnetime(EventType.BackwardFinish, () => { ChangeDressPanel.TweenForCG(); });
  371. Panel.TweenBacVec();
  372. }
  373. }
  374. public static void UpdateTotalCost(bool excludeBought)
  375. {
  376. List<KV<Current, KV<int, double>>> costKvs = CloseItem.GetTotalBuyCost(excludeBought, CloseIDs);
  377. foreach (var costKv in costKvs)
  378. {
  379. if (costKv.Key == Current.Coin) TotalCoin = costKv.Value;
  380. if (costKv.Key == Current.Diamond) TotalDiamond = costKv.Value;
  381. }
  382. CloseTotalCoinText.text = Auxiliary.ShrinkBigNumberStr(TotalCoin.Value);
  383. CloseTotalDiamondText.text = Auxiliary.ShrinkBigNumberStr(TotalDiamond.Value);
  384. }
  385. private static void OnReturnButtonClick()
  386. {
  387. AudioManager.PlayClip(ResourceLabel.BtnClip);
  388. HidePanel();
  389. }
  390. private static void OnPraiseButtonClick()
  391. {
  392. AudioManager.PlayClip(ResourceLabel.BtnClip);
  393. FashionShowData.praised = !FashionShowData.praised;
  394. if (FashionShowData.praised)
  395. {
  396. FashionShowData.praiseCnt++;
  397. }
  398. else
  399. {
  400. FashionShowData.praiseCnt--;
  401. }
  402. RefreshPraiseButton();
  403. PraiseShowHttp.Praise(HttpManager.GetPlayerId(), FashionShowData.showId, null, null);
  404. }
  405. private static void RefreshPraiseButton()
  406. {
  407. if (FashionShowData.praised)
  408. {
  409. PraiseButton.image.color = Lib.Pink;
  410. }
  411. else
  412. {
  413. PraiseButton.image.color = Color.white;
  414. }
  415. PraiseText.text = FashionShowData.praiseCnt.ToString();
  416. }
  417. private static void OnCommentButtonClick()
  418. {
  419. AudioManager.PlayClip(ResourceLabel.BtnClip);
  420. FashionShowCommentPanel.ShowPanel();
  421. }
  422. private static void OnShareButtonClick()
  423. {
  424. AudioManager.PlayClip(ResourceLabel.BtnClip);
  425. }
  426. private static void OnDisplayEditButtonClick()
  427. {
  428. AudioManager.PlayClip(ResourceLabel.BtnClip);
  429. LeaveToRateMode = true;
  430. EnterEditMode();
  431. }
  432. private static void OnSaveButtonClick()
  433. {
  434. AudioManager.PlayClip(ResourceLabel.BtnClip);
  435. if (string.IsNullOrEmpty(FashionTitleInputField.text))
  436. {
  437. Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_EmptyTitle));
  438. return;
  439. }
  440. if (string.IsNullOrEmpty(FashionContentInputField.text))
  441. {
  442. Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_EmptyContent));
  443. return;
  444. }
  445. if (StringFilter.ContainSensitiveWord(FashionTitleInputField.text))
  446. {
  447. Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_BadTitle));
  448. return;
  449. }
  450. if (StringFilter.ContainSensitiveWord(FashionContentInputField.text))
  451. {
  452. Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_BadContent));
  453. return;
  454. }
  455. if (FashionShowData.playerNickName == FashionTitleInputField.text && FashionShowData.content == FashionContentInputField.text)
  456. {
  457. Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_RepeatData));
  458. return;
  459. }
  460. SaveButton.interactable = false;
  461. GetFashionShowData data = new GetFashionShowData(FashionShowData);
  462. data.title = FashionTitleInputField.text;
  463. data.content = FashionContentInputField.text;
  464. if (data.showId == -1)
  465. {
  466. AddShowHttp.Add(data, OnAddSucceedCallback, OnAddFailedCallback);
  467. }
  468. else
  469. {
  470. ModifyShowHttp.Modify(data, OnModifySucceedCallback, OnModifyFailedCallback);
  471. }
  472. }
  473. private static void OnAddFailedCallback()
  474. {
  475. SaveButton.interactable = true;
  476. Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_SaveFailed));
  477. }
  478. private static void OnAddSucceedCallback(object obj)
  479. {
  480. GetFashionShowData fashionShowData = (GetFashionShowData) obj;
  481. FashionShowData.showId = fashionShowData.showId;
  482. FashionShowData.title = fashionShowData.title;
  483. FashionShowData.content = fashionShowData.content;
  484. SaveButton.interactable = true;
  485. Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_SaveSucceed));
  486. DeleteButton.SetActive(true);
  487. }
  488. private static void OnModifyFailedCallback()
  489. {
  490. SaveButton.interactable = true;
  491. Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_SaveFailed));
  492. }
  493. private static void OnModifySucceedCallback(object obj)
  494. {
  495. GetFashionShowData fashionShowData = (GetFashionShowData)obj;
  496. FashionShowData.title = fashionShowData.title;
  497. FashionShowData.content = fashionShowData.content;
  498. SaveButton.interactable = true;
  499. Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_SaveSucceed));
  500. }
  501. private static void OnResetButtonClick()
  502. {
  503. AudioManager.PlayClip(ResourceLabel.BtnClip);
  504. FashionTitleInputField.text = FashionShowData.title;
  505. FashionContentInputField.text = FashionShowData.content;
  506. }
  507. private static void OnDeleteButtonClick()
  508. {
  509. Bubble.Show
  510. (
  511. null,
  512. Language.GetStr(LanguageLabel.UI__Pg_DeleteWarning),
  513. null,
  514. null,
  515. () =>
  516. {
  517. HidePanel();
  518. HidePanel();
  519. long playerId = HttpManager.GetPlayerId();
  520. DeleteShowHttp.Delete(playerId, FashionShowData.showId, null, null);
  521. //HttpManager.DeleteFashionShowData();
  522. }
  523. );
  524. }
  525. private static void OnBuyAllButtonClick()
  526. {
  527. //Debug.Log(TotalCoin.Value);
  528. UpdateTotalCost(true);
  529. if (TotalCoin.Value > Manager.Coin)
  530. {
  531. Bubble.Show(Language.GetStr(LanguageLabel.Common__ShortCoin));
  532. return;
  533. }
  534. if (TotalDiamond.Value > Manager.Diamond)
  535. {
  536. Bubble.Show(Language.GetStr(LanguageLabel.Common__ShortDiamond));
  537. return;
  538. }
  539. Manager.Pay("", TotalCoin.Value, Current.Coin, OnBuyAllSucceedCallback, StaticsManager.ItemID.解锁服装, StaticsManager.ConsumeModule.Charge, false, false, null, TotalCoin.Key);
  540. Manager.Pay("", TotalDiamond.Value, Current.Diamond, OnBuyAllSucceedCallback, StaticsManager.ItemID.解锁服装, StaticsManager.ConsumeModule.Charge, false, false, null, TotalDiamond.Key);
  541. }
  542. private static void OnBuyAllSucceedCallback()
  543. {
  544. foreach (var closeItem in CloseItems)
  545. {
  546. if (!closeItem.CloseItem.IsBought)
  547. {
  548. closeItem.CloseItem.OnBuySucceed();
  549. closeItem.Text.SetActive(true);
  550. }
  551. }
  552. }
  553. private static void OnRateButtonClick()
  554. {
  555. HideRateButton();
  556. AudioManager.PlayClip(ResourceLabel.BtnClip);
  557. EnableRatePanel();
  558. }
  559. private static void OnSubmitRateClick()
  560. {
  561. if (IsRateChanged() == false)
  562. {
  563. Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_RateDidntChange));
  564. return;
  565. }
  566. SubmitRate();
  567. ShowRateButton();
  568. AudioManager.PlayClip(ResourceLabel.BtnClip);
  569. DisableRatePanel();
  570. ShowRateValue();
  571. }
  572. private static void SubmitRate()
  573. {
  574. ShowRateData data = new ShowRateData();
  575. data.showId = FashionShowData.showId;
  576. data.playerId = HttpManager.GetPlayerId();
  577. data.cuteRate = (int) CuteSlider.value;
  578. data.vividRate = (int) VividSlider.value;
  579. data.simpleRate = (int) SimpleSlider.value;
  580. data.graceRate = (int) GraceSlider.value;
  581. data.gloryRate = (int) GlorySlider.value;
  582. RateShowHttp.Rate(data, null, null);
  583. }
  584. private static bool IsRateChanged()
  585. {
  586. if (CuteValue.text == "--")
  587. return false;
  588. if (VividValue.text == "--")
  589. return false;
  590. if (GloryValue.text == "--")
  591. return false;
  592. if (GraceValue.text == "--")
  593. return false;
  594. if (SimpleValue.text == "--")
  595. return false;
  596. return true;
  597. }
  598. private static void OnResetRateClick()
  599. {
  600. ShowRateButton();
  601. AudioManager.PlayClip(ResourceLabel.BtnClip);
  602. DisableRatePanel();
  603. ShowRateValue();
  604. }
  605. private static void ShowRateButton()
  606. {
  607. RateButton.SetActive(true);
  608. rateButtonAnim.Resume();
  609. }
  610. private static void HideRateButton()
  611. {
  612. RateButton.SetActive(false);
  613. rateButtonAnim.Pause();
  614. }
  615. private static void EnableRatePanel()
  616. {
  617. SubmitRateButton.SetActive(true);
  618. ResetRateButton.SetActive(true);
  619. CuteSliderBg.SetActive(true);
  620. GlorySliderBg.SetActive(true);
  621. GraceSliderBg.SetActive(true);
  622. SimpleSliderBg.SetActive(true);
  623. VividSliderBg.SetActive(true);
  624. CuteSlider.interactable = true;
  625. GlorySlider.interactable = true;
  626. GraceSlider.interactable = true;
  627. SimpleSlider.interactable = true;
  628. VividSlider.interactable = true;
  629. CuteSlider.value = 0;
  630. GlorySlider.value = 0;
  631. SimpleSlider.value = 0;
  632. VividSlider.value = 0;
  633. GraceSlider.value = 0;
  634. CuteValue.text = "--";
  635. GloryValue.text = "--";
  636. GraceValue.text = "--";
  637. SimpleValue.text = "--";
  638. VividValue.text = "--";
  639. }
  640. private static void DisableRatePanel()
  641. {
  642. SubmitRateButton.SetActive(false);
  643. ResetRateButton.SetActive(false);
  644. CuteSliderBg.SetActive(false);
  645. GlorySliderBg.SetActive(false);
  646. GraceSliderBg.SetActive(false);
  647. SimpleSliderBg.SetActive(false);
  648. VividSliderBg.SetActive(false);
  649. CuteSlider.interactable = false;
  650. GlorySlider.interactable = false;
  651. GraceSlider.interactable = false;
  652. SimpleSlider.interactable = false;
  653. VividSlider.interactable = false;
  654. }
  655. private static void OnCuteSliderValueChange(float value)
  656. {
  657. AudioManager.PlayClip(ResourceLabel.BtnClip);
  658. CuteRateText.text = value.ToString("0");
  659. CuteValue.text = value.ToString("0");
  660. }
  661. private static void OnCuteSliderSelect()
  662. {
  663. CuteRateBackground.SetActive(true);
  664. }
  665. private static void OnCuteSliderDeselect()
  666. {
  667. CuteRateBackground.SetActive(false);
  668. }
  669. private static void OnGraceSliderValueChange(float value)
  670. {
  671. AudioManager.PlayClip(ResourceLabel.BtnClip);
  672. GraceRateText.text = value.ToString("0");
  673. GraceValue.text = value.ToString("0");
  674. }
  675. private static void OnGraceSliderSelect()
  676. {
  677. GraceRateBackground.SetActive(true);
  678. }
  679. private static void OnGraceSliderDeselect()
  680. {
  681. GraceRateBackground.SetActive(false);
  682. }
  683. private static void OnVividSliderValueChange(float value)
  684. {
  685. AudioManager.PlayClip(ResourceLabel.BtnClip);
  686. VividRateText.text = value.ToString("0");
  687. VividValue.text = value.ToString("0");
  688. }
  689. private static void OnVividSliderSelect()
  690. {
  691. VividRateBackground.SetActive(true);
  692. }
  693. private static void OnVividSliderDeselect()
  694. {
  695. VividRateBackground.SetActive(false);
  696. }
  697. private static void OnSimpleSliderValueChange(float value)
  698. {
  699. AudioManager.PlayClip(ResourceLabel.BtnClip);
  700. SimpleRateText.text = value.ToString("0");
  701. SimpleValue.text = value.ToString("0");
  702. }
  703. private static void OnSimpleSliderSelect()
  704. {
  705. SimpleRateBackground.SetActive(true);
  706. }
  707. private static void OnSimpleSliderDeselect()
  708. {
  709. SimpleRateBackground.SetActive(false);
  710. }
  711. private static void OnGlorySliderValueChange(float value)
  712. {
  713. AudioManager.PlayClip(ResourceLabel.BtnClip);
  714. GloryRateText.text = value.ToString("0");
  715. GloryValue.text = value.ToString("0");
  716. }
  717. private static void OnGlorySliderSelect()
  718. {
  719. GloryRateBackground.SetActive(true);
  720. }
  721. private static void OnGlorySliderDeselect()
  722. {
  723. GloryRateBackground.SetActive(false);
  724. }
  725. private static void OnLevelChange(int level)
  726. {
  727. //GardenFashionShowButtonParent.SetActive(false);
  728. //DressroomFashionShowButton.SetActive(false);
  729. if (level >= UnlockLevel)
  730. {
  731. GardenFashionShowButtonParent.SetActive(true);
  732. DressroomFashionShowButton.SetActive(true);
  733. }
  734. else
  735. {
  736. GardenFashionShowButtonParent.SetActive(false);
  737. DressroomFashionShowButton.SetActive(false);
  738. }
  739. }
  740. private static void OnDressroomFashionShowButtonClick()
  741. {
  742. AudioManager.PlayClip(ResourceLabel.BtnClip);
  743. GetFashionShowData data = new GetFashionShowData();
  744. data.showId = -1;
  745. data.cuteScore = 0;
  746. data.gloryScore = 0;
  747. data.graceScore = 0;
  748. data.simpleScore = 0;
  749. data.vividScore = 0;
  750. data.title = "";
  751. data.content = "";
  752. data.playerId = HttpManager.GetPlayerId();
  753. List<int> closeIds = PlayerManager.Player.GetCurrentChangableDressIDs();
  754. data.SetCloseIds(closeIds);
  755. ShowEditPanel(data);
  756. }
  757. }