FashionShowEditPage.cs 33 KB

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