FashionShowEditPage.cs 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869
  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. public 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. if (FashionShowData.rated == false)
  333. {
  334. ShowRateButton();
  335. }
  336. bool haveUnboughtClose = false;
  337. foreach (var closeItem in CloseItems)
  338. {
  339. if (closeItem.CloseItem.IsBought)
  340. {
  341. closeItem.Text.SetActive(true);
  342. }
  343. else
  344. {
  345. closeItem.Text.SetActive(false);
  346. closeItem.BoxButton.interactable = true;
  347. haveUnboughtClose = true;
  348. }
  349. }
  350. BuyAllButton.SetActive(haveUnboughtClose);
  351. UpdateTotalCost(true);
  352. }
  353. public static void HidePanel()
  354. {
  355. if (LeaveToRateMode)
  356. {
  357. EnterRateMode();
  358. LeaveToRateMode = false;
  359. }
  360. else if (LeaveToHomePage)
  361. {
  362. DisplayPlayer.DisplayInScene();
  363. ResourceManager.Save(DisplayPlayer);
  364. Panel.GetTweenVec().AddEventOnetime(EventType.BackwardFinish, () => { FashionShowHomePage.ShowSidePanel(); });
  365. Panel.TweenBacVec();
  366. LeaveToHomePage = false;
  367. }
  368. else
  369. {
  370. DestroyImmediate(DisplayPlayer.gameObject);
  371. //DisplayPlayer.DisplayInScene();
  372. //ResourceManager.Save(DisplayPlayer);
  373. if (PlayerTween != null)
  374. {
  375. PlayerTween.StartForward();
  376. }
  377. Panel.GetTweenVec().AddEventOnetime(EventType.BackwardFinish, () => { ChangeDressPanel.TweenForCG(); });
  378. Panel.TweenBacVec();
  379. }
  380. }
  381. public static void UpdateTotalCost(bool excludeBought)
  382. {
  383. List<KV<Current, KV<int, double>>> costKvs = CloseItem.GetTotalBuyCost(excludeBought, CloseIDs);
  384. foreach (var costKv in costKvs)
  385. {
  386. if (costKv.Key == Current.Coin) TotalCoin = costKv.Value;
  387. if (costKv.Key == Current.Diamond) TotalDiamond = costKv.Value;
  388. }
  389. CloseTotalCoinText.text = Auxiliary.ShrinkBigNumberStr(TotalCoin.Value);
  390. CloseTotalDiamondText.text = Auxiliary.ShrinkBigNumberStr(TotalDiamond.Value);
  391. }
  392. private static void OnReturnButtonClick()
  393. {
  394. AudioManager.PlayClip(ResourceLabel.BtnClip);
  395. HidePanel();
  396. }
  397. private static void OnPraiseButtonClick()
  398. {
  399. AudioManager.PlayClip(ResourceLabel.BtnClip);
  400. FashionShowData.praised = !FashionShowData.praised;
  401. if (FashionShowData.praised)
  402. {
  403. FashionShowData.praiseCnt++;
  404. }
  405. else
  406. {
  407. FashionShowData.praiseCnt--;
  408. }
  409. RefreshPraiseButton();
  410. PraiseShowHttp.Praise(HttpManager.GetPlayerId(), FashionShowData.showId, null, null);
  411. }
  412. private static void RefreshPraiseButton()
  413. {
  414. if (FashionShowData.praised)
  415. {
  416. PraiseButton.image.color = Lib.Pink;
  417. }
  418. else
  419. {
  420. PraiseButton.image.color = Color.white;
  421. }
  422. PraiseText.text = FashionShowData.praiseCnt.ToString();
  423. }
  424. private static void OnCommentButtonClick()
  425. {
  426. AudioManager.PlayClip(ResourceLabel.BtnClip);
  427. FashionShowCommentPanel.ShowPanel(FashionShowData);
  428. }
  429. private static void OnShareButtonClick()
  430. {
  431. AudioManager.PlayClip(ResourceLabel.BtnClip);
  432. }
  433. private static void OnDisplayEditButtonClick()
  434. {
  435. AudioManager.PlayClip(ResourceLabel.BtnClip);
  436. LeaveToRateMode = true;
  437. EnterEditMode();
  438. }
  439. private static void OnSaveButtonClick()
  440. {
  441. AudioManager.PlayClip(ResourceLabel.BtnClip);
  442. if (string.IsNullOrEmpty(FashionTitleInputField.text))
  443. {
  444. Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_EmptyTitle));
  445. return;
  446. }
  447. if (string.IsNullOrEmpty(FashionContentInputField.text))
  448. {
  449. Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_EmptyContent));
  450. return;
  451. }
  452. if (StringFilter.ContainSensitiveWord(FashionTitleInputField.text))
  453. {
  454. Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_BadTitle));
  455. return;
  456. }
  457. if (StringFilter.ContainSensitiveWord(FashionContentInputField.text))
  458. {
  459. Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_BadContent));
  460. return;
  461. }
  462. if (FashionShowData.playerNickName == FashionTitleInputField.text && FashionShowData.content == FashionContentInputField.text)
  463. {
  464. Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_RepeatData));
  465. return;
  466. }
  467. SaveButton.interactable = false;
  468. GetFashionShowData data = new GetFashionShowData(FashionShowData);
  469. data.title = FashionTitleInputField.text;
  470. data.content = FashionContentInputField.text;
  471. if (data.showId == -1)
  472. {
  473. AddShowHttp.Add(data, OnAddSucceedCallback, OnAddFailedCallback);
  474. }
  475. else
  476. {
  477. ModifyShowHttp.Modify(data, OnModifySucceedCallback, OnModifyFailedCallback);
  478. }
  479. }
  480. private static void OnAddFailedCallback()
  481. {
  482. SaveButton.interactable = true;
  483. Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_SaveFailed));
  484. }
  485. private static void OnAddSucceedCallback(object obj)
  486. {
  487. GetFashionShowData fashionShowData = (GetFashionShowData) obj;
  488. FashionShowData.showId = fashionShowData.showId;
  489. FashionShowData.title = fashionShowData.title;
  490. FashionShowData.content = fashionShowData.content;
  491. SaveButton.interactable = true;
  492. Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_SaveSucceed));
  493. DeleteButton.SetActive(true);
  494. }
  495. private static void OnModifyFailedCallback()
  496. {
  497. SaveButton.interactable = true;
  498. Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_SaveFailed));
  499. }
  500. private static void OnModifySucceedCallback(object obj)
  501. {
  502. GetFashionShowData fashionShowData = (GetFashionShowData)obj;
  503. FashionShowData.title = fashionShowData.title;
  504. FashionShowData.content = fashionShowData.content;
  505. SaveButton.interactable = true;
  506. Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_SaveSucceed));
  507. }
  508. private static void OnResetButtonClick()
  509. {
  510. AudioManager.PlayClip(ResourceLabel.BtnClip);
  511. FashionTitleInputField.text = FashionShowData.title;
  512. FashionContentInputField.text = FashionShowData.content;
  513. }
  514. private static void OnDeleteButtonClick()
  515. {
  516. Bubble.Show
  517. (
  518. null,
  519. Language.GetStr(LanguageLabel.UI__Pg_DeleteWarning),
  520. null,
  521. null,
  522. () =>
  523. {
  524. HidePanel();
  525. HidePanel();
  526. long playerId = HttpManager.GetPlayerId();
  527. DeleteShowHttp.Delete(playerId, FashionShowData.showId, null, null);
  528. //HttpManager.DeleteFashionShowData();
  529. }
  530. );
  531. }
  532. private static void OnBuyAllButtonClick()
  533. {
  534. //Debug.Log(TotalCoin.Value);
  535. UpdateTotalCost(true);
  536. if (TotalCoin.Value > Manager.Coin)
  537. {
  538. Bubble.Show(Language.GetStr(LanguageLabel.Common__ShortCoin));
  539. return;
  540. }
  541. if (TotalDiamond.Value > Manager.Diamond)
  542. {
  543. Bubble.Show(Language.GetStr(LanguageLabel.Common__ShortDiamond));
  544. return;
  545. }
  546. Manager.Pay("", TotalCoin.Value, Current.Coin, OnBuyAllSucceedCallback, StaticsManager.ItemID.解锁服装, StaticsManager.ConsumeModule.Charge, false, false, null, TotalCoin.Key);
  547. Manager.Pay("", TotalDiamond.Value, Current.Diamond, OnBuyAllSucceedCallback, StaticsManager.ItemID.解锁服装, StaticsManager.ConsumeModule.Charge, false, false, null, TotalDiamond.Key);
  548. }
  549. private static void OnBuyAllSucceedCallback()
  550. {
  551. foreach (var closeItem in CloseItems)
  552. {
  553. if (!closeItem.CloseItem.IsBought)
  554. {
  555. closeItem.CloseItem.OnBuySucceed();
  556. closeItem.Text.SetActive(true);
  557. }
  558. }
  559. }
  560. private static void OnRateButtonClick()
  561. {
  562. HideRateButton();
  563. AudioManager.PlayClip(ResourceLabel.BtnClip);
  564. EnableRatePanel();
  565. }
  566. private static void OnSubmitRateClick()
  567. {
  568. if (IsRateChanged() == false)
  569. {
  570. Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_RateDidntChange));
  571. return;
  572. }
  573. SubmitRate();
  574. //ShowRateButton();
  575. AudioManager.PlayClip(ResourceLabel.BtnClip);
  576. DisableRatePanel();
  577. ShowRateValue();
  578. }
  579. private static void SubmitRate()
  580. {
  581. ShowRateData data = new ShowRateData();
  582. data.showId = FashionShowData.showId;
  583. data.playerId = HttpManager.GetPlayerId();
  584. data.cuteRate = (int) CuteSlider.value;
  585. data.vividRate = (int) VividSlider.value;
  586. data.simpleRate = (int) SimpleSlider.value;
  587. data.graceRate = (int) GraceSlider.value;
  588. data.gloryRate = (int) GlorySlider.value;
  589. RateShowHttp.Rate(data, null, null);
  590. }
  591. private static bool IsRateChanged()
  592. {
  593. if (CuteValue.text == "--")
  594. return false;
  595. if (VividValue.text == "--")
  596. return false;
  597. if (GloryValue.text == "--")
  598. return false;
  599. if (GraceValue.text == "--")
  600. return false;
  601. if (SimpleValue.text == "--")
  602. return false;
  603. return true;
  604. }
  605. private static void OnResetRateClick()
  606. {
  607. ShowRateButton();
  608. AudioManager.PlayClip(ResourceLabel.BtnClip);
  609. DisableRatePanel();
  610. ShowRateValue();
  611. }
  612. private static void ShowRateButton()
  613. {
  614. RateButton.SetActive(true);
  615. rateButtonAnim.Resume();
  616. }
  617. private static void HideRateButton()
  618. {
  619. RateButton.SetActive(false);
  620. rateButtonAnim.Pause();
  621. }
  622. private static void EnableRatePanel()
  623. {
  624. SubmitRateButton.SetActive(true);
  625. ResetRateButton.SetActive(true);
  626. CuteSliderBg.SetActive(true);
  627. GlorySliderBg.SetActive(true);
  628. GraceSliderBg.SetActive(true);
  629. SimpleSliderBg.SetActive(true);
  630. VividSliderBg.SetActive(true);
  631. CuteSlider.interactable = true;
  632. GlorySlider.interactable = true;
  633. GraceSlider.interactable = true;
  634. SimpleSlider.interactable = true;
  635. VividSlider.interactable = true;
  636. CuteSlider.value = 0;
  637. GlorySlider.value = 0;
  638. SimpleSlider.value = 0;
  639. VividSlider.value = 0;
  640. GraceSlider.value = 0;
  641. CuteValue.text = "--";
  642. GloryValue.text = "--";
  643. GraceValue.text = "--";
  644. SimpleValue.text = "--";
  645. VividValue.text = "--";
  646. }
  647. private static void DisableRatePanel()
  648. {
  649. SubmitRateButton.SetActive(false);
  650. ResetRateButton.SetActive(false);
  651. CuteSliderBg.SetActive(false);
  652. GlorySliderBg.SetActive(false);
  653. GraceSliderBg.SetActive(false);
  654. SimpleSliderBg.SetActive(false);
  655. VividSliderBg.SetActive(false);
  656. CuteSlider.interactable = false;
  657. GlorySlider.interactable = false;
  658. GraceSlider.interactable = false;
  659. SimpleSlider.interactable = false;
  660. VividSlider.interactable = false;
  661. }
  662. private static void OnCuteSliderValueChange(float value)
  663. {
  664. AudioManager.PlayClip(ResourceLabel.BtnClip);
  665. CuteRateText.text = value.ToString("0");
  666. CuteValue.text = value.ToString("0");
  667. }
  668. private static void OnCuteSliderSelect()
  669. {
  670. CuteRateBackground.SetActive(true);
  671. }
  672. private static void OnCuteSliderDeselect()
  673. {
  674. CuteRateBackground.SetActive(false);
  675. }
  676. private static void OnGraceSliderValueChange(float value)
  677. {
  678. AudioManager.PlayClip(ResourceLabel.BtnClip);
  679. GraceRateText.text = value.ToString("0");
  680. GraceValue.text = value.ToString("0");
  681. }
  682. private static void OnGraceSliderSelect()
  683. {
  684. GraceRateBackground.SetActive(true);
  685. }
  686. private static void OnGraceSliderDeselect()
  687. {
  688. GraceRateBackground.SetActive(false);
  689. }
  690. private static void OnVividSliderValueChange(float value)
  691. {
  692. AudioManager.PlayClip(ResourceLabel.BtnClip);
  693. VividRateText.text = value.ToString("0");
  694. VividValue.text = value.ToString("0");
  695. }
  696. private static void OnVividSliderSelect()
  697. {
  698. VividRateBackground.SetActive(true);
  699. }
  700. private static void OnVividSliderDeselect()
  701. {
  702. VividRateBackground.SetActive(false);
  703. }
  704. private static void OnSimpleSliderValueChange(float value)
  705. {
  706. AudioManager.PlayClip(ResourceLabel.BtnClip);
  707. SimpleRateText.text = value.ToString("0");
  708. SimpleValue.text = value.ToString("0");
  709. }
  710. private static void OnSimpleSliderSelect()
  711. {
  712. SimpleRateBackground.SetActive(true);
  713. }
  714. private static void OnSimpleSliderDeselect()
  715. {
  716. SimpleRateBackground.SetActive(false);
  717. }
  718. private static void OnGlorySliderValueChange(float value)
  719. {
  720. AudioManager.PlayClip(ResourceLabel.BtnClip);
  721. GloryRateText.text = value.ToString("0");
  722. GloryValue.text = value.ToString("0");
  723. }
  724. private static void OnGlorySliderSelect()
  725. {
  726. GloryRateBackground.SetActive(true);
  727. }
  728. private static void OnGlorySliderDeselect()
  729. {
  730. GloryRateBackground.SetActive(false);
  731. }
  732. private static void OnLevelChange(int level)
  733. {
  734. //GardenFashionShowButtonParent.SetActive(false);
  735. //DressroomFashionShowButton.SetActive(false);
  736. if (level >= UnlockLevel)
  737. {
  738. GardenFashionShowButtonParent.SetActive(true);
  739. DressroomFashionShowButton.SetActive(true);
  740. }
  741. else
  742. {
  743. GardenFashionShowButtonParent.SetActive(false);
  744. DressroomFashionShowButton.SetActive(false);
  745. }
  746. }
  747. private static void OnDressroomFashionShowButtonClick()
  748. {
  749. AudioManager.PlayClip(ResourceLabel.BtnClip);
  750. GetFashionShowData data = new GetFashionShowData();
  751. data.showId = -1;
  752. data.cuteScore = 0;
  753. data.gloryScore = 0;
  754. data.graceScore = 0;
  755. data.simpleScore = 0;
  756. data.vividScore = 0;
  757. data.title = "";
  758. data.content = "";
  759. data.playerId = HttpManager.GetPlayerId();
  760. List<int> closeIds = PlayerManager.Player.GetCurrentChangableDressIDs();
  761. data.SetCloseIds(closeIds);
  762. ShowEditPanel(data);
  763. }
  764. }