FashionShowEditPage.cs 32 KB

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