FashionShowEditPage.cs 33 KB

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