123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class FashionShowEditPage : Regist
- {
- #region Config
- //StartMark-Used by LabelUtility-Do not remove
- private static Text CoinText;
- private static Text DiamondText;
- private static Text RecommendTitle;
- private static Text PraiseText;
- private static Text FashionTitlePlaceHolder;
- private static Text FashionContentPlaceHolder;
- private static Text CuteTitle;
- private static Text CuteValue;
- private static Text CuteRateText;
- private static Text GraceTitle;
- private static Text GraceValue;
- private static Text GraceRateText;
- private static Text VividTitle;
- private static Text VividValue;
- private static Text VividRateText;
- private static Text SimpleTitle;
- private static Text SimpleValue;
- private static Text SimpleRateText;
- private static Text GloryTitle;
- private static Text GloryValue;
- private static Text GloryRateText;
- private static Text FashionShowClosesTitle;
- private static Text CloseTotalCoinText;
- private static Text CloseTotalDiamondText;
- private static Button Return;
- private static Button DisplayEditButton;
- private static Button DeleteButton;
- private static Button ResetButton;
- private static Button SaveButton;
- private static Button PraiseButton;
- private static Button CommentButton;
- private static Button ShareButton;
- private static Button FashionTitleEditButton;
- private static Button FashionContentEditButton;
- private static Button RateButton;
- //EndMark-Used by LabelUtility-Do not remove
- private static Button SubmitRateButton;
- private static Button ResetRateButton;
- private static TweenOutline rateButtonAnim;
- private static Button DressroomFashionShowButton;
- private static Transform GardenFashionShowButtonParent;
- private static Text BuyAllButtonText;
- private static Button BuyAllButton;
- public static Transform Panel;
- private static Transform ChangeDressPanel;
- private static Transform DisplayBackground;
- private static Transform CuteRateBackground;
- private static Transform GraceRateBackground;
- private static Transform VividRateBackground;
- private static Transform SimpleRateBackground;
- private static Transform GloryRateBackground;
- private static Transform FashionShowCloseGrid;
- private static InputField FashionTitleInputField;
- private static InputField FashionContentInputField;
- private static CustomSlider CuteSlider;
- private static CustomSlider GraceSlider;
- private static CustomSlider VividSlider;
- private static CustomSlider SimpleSlider;
- private static CustomSlider GlorySlider;
- private static Transform CuteSliderBg;
- private static Transform GraceSliderBg;
- private static Transform VividSliderBg;
- private static Transform SimpleSliderBg;
- private static Transform GlorySliderBg;
- //private static bool Praised;
- private static bool BelongSelf;
- private static bool LeaveToRateMode;
- public static bool LeaveToHomePage;
- public static Player DisplayPlayer;
- private static KV<int, double> TotalCoin;
- private static KV<int, double> TotalDiamond;
- //private static TweenRenderer PlayerTween;
- private static GetFashionShowData FashionShowData;
- private static List<int> CloseIDs = new List<int>();
- //private static List<string> CloseNames = new List<string>();
- private static List<FashionShowCloseItem> CloseItems = new List<FashionShowCloseItem>();
- private static int UnlockLevel = 21;
- #endregion
- public override void RegistReference()
- {
- CoinText = ResourceManager.Get<Text>(CanvasLabel.Pg_CoinText);
- DiamondText = ResourceManager.Get<Text>(CanvasLabel.Pg_DiamondText);
- RecommendTitle = ResourceManager.Get<Text>(CanvasLabel.Pg_RecommendTitle);
- PraiseText = ResourceManager.Get<Text>(CanvasLabel.Pg_PraiseText);
- FashionTitlePlaceHolder = ResourceManager.Get<Text>(CanvasLabel.Pg_FashionTitlePlaceHolder);
- FashionContentPlaceHolder = ResourceManager.Get<Text>(CanvasLabel.Pg_FashionContentPlaceHolder);
- CuteTitle = ResourceManager.Get<Text>(CanvasLabel.Pg_CuteTitle);
- CuteValue = ResourceManager.Get<Text>(CanvasLabel.Pg_CuteValue);
- CuteRateText = ResourceManager.Get<Text>(CanvasLabel.Pg_CuteRateText);
- GraceTitle = ResourceManager.Get<Text>(CanvasLabel.Pg_GraceTitle);
- GraceValue = ResourceManager.Get<Text>(CanvasLabel.Pg_GraceValue);
- GraceRateText = ResourceManager.Get<Text>(CanvasLabel.Pg_GraceRateText);
- VividTitle = ResourceManager.Get<Text>(CanvasLabel.Pg_VividTitle);
- VividValue = ResourceManager.Get<Text>(CanvasLabel.Pg_VividValue);
- VividRateText = ResourceManager.Get<Text>(CanvasLabel.Pg_VividRateText);
- SimpleTitle = ResourceManager.Get<Text>(CanvasLabel.Pg_SimpleTitle);
- SimpleValue = ResourceManager.Get<Text>(CanvasLabel.Pg_SimpleValue);
- SimpleRateText = ResourceManager.Get<Text>(CanvasLabel.Pg_SimpleRateText);
- GloryTitle = ResourceManager.Get<Text>(CanvasLabel.Pg_GloryTitle);
- GloryValue = ResourceManager.Get<Text>(CanvasLabel.Pg_GloryValue);
- GloryRateText = ResourceManager.Get<Text>(CanvasLabel.Pg_GloryRateText);
- FashionShowClosesTitle = ResourceManager.Get<Text>(CanvasLabel.Pg_FashionShowClosesTitle);
- CloseTotalCoinText = ResourceManager.Get<Text>(CanvasLabel.Pg_CloseTotalCoinText);
- CloseTotalDiamondText = ResourceManager.Get<Text>(CanvasLabel.Pg_CloseTotalDiamondText);
- CuteSlider = ResourceManager.Get<CustomSlider>(CanvasLabel.Pg_CuteSlider);
- GraceSlider = ResourceManager.Get<CustomSlider>(CanvasLabel.Pg_GraceSlider);
- VividSlider = ResourceManager.Get<CustomSlider>(CanvasLabel.Pg_VividSlider);
- SimpleSlider = ResourceManager.Get<CustomSlider>(CanvasLabel.Pg_SimpleSlider);
- GlorySlider = ResourceManager.Get<CustomSlider>(CanvasLabel.Pg_GlorySlider);
- CuteSliderBg = ResourceManager.Get(CanvasLabel.Pg_CuteBackground);
- GraceSliderBg = ResourceManager.Get(CanvasLabel.Pg_GraceBackground);
- VividSliderBg = ResourceManager.Get(CanvasLabel.Pg_VividBackground);
- SimpleSliderBg = ResourceManager.Get(CanvasLabel.Pg_SimpleBackground);
- GlorySliderBg = ResourceManager.Get(CanvasLabel.Pg_GloryBackground);
- Return = ResourceManager.Get<Button>(CanvasLabel.Pg_Return);
- DisplayEditButton = ResourceManager.Get<Button>(CanvasLabel.Pg_DisplayEditButton);
- DeleteButton = ResourceManager.Get<Button>(CanvasLabel.Pg_DeleteButton);
- ResetButton = ResourceManager.Get<Button>(CanvasLabel.Pg_ResetButton);
- SaveButton = ResourceManager.Get<Button>(CanvasLabel.Pg_SaveButton);
- PraiseButton = ResourceManager.Get<Button>(CanvasLabel.Pg_PraiseButton);
- CommentButton = ResourceManager.Get<Button>(CanvasLabel.Pg_CommentButton);
- ShareButton = ResourceManager.Get<Button>(CanvasLabel.Pg_ShareButton);
- FashionTitleEditButton = ResourceManager.Get<Button>(CanvasLabel.Pg_FashionTitleEditButton);
- FashionContentEditButton = ResourceManager.Get<Button>(CanvasLabel.Pg_FashionContentEditButton);
- RateButton = ResourceManager.Get<Button>(CanvasLabel.Pg_RateButton);
- SubmitRateButton = ResourceManager.Get<Button>(CanvasLabel.Pg_SubmitRateButton);
- ResetRateButton = ResourceManager.Get<Button>(CanvasLabel.Pg_ResetRateButton);
- DressroomFashionShowButton = ResourceManager.Get<Button>(CanvasLabel.P_FashionShowButton);
- GardenFashionShowButtonParent = ResourceManager.Get(CanvasLabel.C_FashionShowButtonParent);
- BuyAllButtonText = ResourceManager.Get<Text>(CanvasLabel.Pg_BuyAllButtonText);
- BuyAllButton= ResourceManager.Get<Button>(CanvasLabel.Pg_BuyAllButton);
- Panel = ResourceManager.Get(CanvasLabel.Pg_FashionShowEditPanel);
- ChangeDressPanel = ResourceManager.Get(CanvasLabel.P_ChangeDressPanel);
- DisplayBackground = ResourceManager.Get(CanvasLabel.Pg_DisplayBackground);
- CuteRateBackground = ResourceManager.Get(CanvasLabel.Pg_CuteRateBackground);
- GraceRateBackground = ResourceManager.Get(CanvasLabel.Pg_GraceRateBackground);
- VividRateBackground = ResourceManager.Get(CanvasLabel.Pg_VividRateBackground);
- SimpleRateBackground = ResourceManager.Get(CanvasLabel.Pg_SimpleRateBackground);
- GloryRateBackground = ResourceManager.Get(CanvasLabel.Pg_GloryRateBackground);
- FashionShowCloseGrid = ResourceManager.Get(CanvasLabel.Pg_FashionShowCloseGrid);
- FashionTitleInputField = ResourceManager.Get<InputField>(CanvasLabel.Pg_FashionTitleBackground);
- FashionContentInputField = ResourceManager.Get<InputField>(CanvasLabel.Pg_FashionContentBackground);
- LanguageManager.Add(FashionTitlePlaceHolder, new MulLanStr(LanguageLabel.UI__Pi_TitleTip));
- LanguageManager.Add(FashionContentPlaceHolder, new MulLanStr(LanguageLabel.UI__Pi_ContentTip));
- LanguageManager.Add(BuyAllButtonText, new MulLanStr(LanguageLabel.UI__Pg_BuyAll));
- LanguageManager.Add(CuteTitle, new MulLanStr(LanguageLabel.UI__Pg_Cute));
- LanguageManager.Add(GraceTitle, new MulLanStr(LanguageLabel.UI__Pg_Grace));
- LanguageManager.Add(SimpleTitle, new MulLanStr(LanguageLabel.UI__Pg_Simple));
- LanguageManager.Add(VividTitle, new MulLanStr(LanguageLabel.UI__Pg_Vivid));
- LanguageManager.Add(GloryTitle, new MulLanStr(LanguageLabel.UI__Pg_Glory));
- LanguageManager.Add(FashionShowClosesTitle, new MulLanStr(LanguageLabel.UI__Pg_CloseGridTitle));
- Panel.CreateTweenVec2D(ResourceManager.Get(CanvasLabel.Pg_FashionShowEditPanelPosition).position, 0.5f, false, false, true, Curve.EaseOutQuad);
- ChangeDressPanel.CreateTweenCG(0, 1, 0.25f, false, true, Curve.EaseOutQuad);
- CuteSlider.onValueChanged.AddListener(OnCuteSliderValueChange);
- CuteSlider.onPointerDown += OnCuteSliderSelect;
- CuteSlider.onPointerUp += OnCuteSliderDeselect;
- GraceSlider.onValueChanged.AddListener(OnGraceSliderValueChange);
- GraceSlider.onPointerDown += OnGraceSliderSelect;
- GraceSlider.onPointerUp += OnGraceSliderDeselect;
- SimpleSlider.onValueChanged.AddListener(OnSimpleSliderValueChange);
- SimpleSlider.onPointerDown += OnSimpleSliderSelect;
- SimpleSlider.onPointerUp += OnSimpleSliderDeselect;
- GlorySlider.onValueChanged.AddListener(OnGlorySliderValueChange);
- GlorySlider.onPointerDown += OnGlorySliderSelect;
- GlorySlider.onPointerUp += OnGlorySliderDeselect;
- VividSlider.onValueChanged.AddListener(OnVividSliderValueChange);
- VividSlider.onPointerDown += OnVividSliderSelect;
- VividSlider.onPointerUp += OnVividSliderDeselect;
- Return.onClick.AddListener(OnReturnButtonClick);
- CommentButton.onClick.AddListener(OnCommentButtonClick);
- PraiseButton.onClick.AddListener(OnPraiseButtonClick);
- ShareButton.onClick.AddListener(OnShareButtonClick);
- DisplayEditButton.onClick.AddListener(OnDisplayEditButtonClick);
- RateButton.onClick.AddListener(OnRateButtonClick);
- SubmitRateButton.onClick.AddListener(OnSubmitRateClick);
- ResetRateButton.onClick.AddListener(OnResetRateClick);
- SaveButton.onClick.AddListener(OnSaveButtonClick);
- ResetButton.onClick.AddListener(OnResetButtonClick);
- DeleteButton.onClick.AddListener(OnDeleteButtonClick);
- BuyAllButton.onClick.AddListener(OnBuyAllButtonClick);
- DressroomFashionShowButton.onClick.AddListener(OnDressroomFashionShowButtonClick);
- Manager.OnLevelChange += OnLevelChange;
- Manager.OnCoinChange += amt => { CoinText.text = ResourceManager.Get<Text>(CanvasLabel.F_CoinLab).text; };
- Manager.OnDiamondChange += amt => { DiamondText.text = ResourceManager.Get<Text>(CanvasLabel.F_DiamondLab).text; };
- Outline outline = RateButton.GetComponent<Outline>();
- Color originColor = outline.effectColor;
- Color destColor = outline.effectColor;
- destColor.a = 0;
- rateButtonAnim = new TweenOutline(outline, originColor, destColor, 0.5f, true, true, Curve.EaseOutQuad);
- rateButtonAnim.OnForwardFinish += () => rateButtonAnim.StartBackward();
- rateButtonAnim.OnBackwardFinish += () => rateButtonAnim.StartForward();
- rateButtonAnim.StartForward();
- rateButtonAnim.Pause();
- }
- public static void ShowEditPanel(GetFashionShowData data)
- {
- BelongSelf = true;
- FashionShowData = data;
- CloseIDs = data.GetCloseIds();
- //CloseNames = Player.DressIDToDressName(data.CloseIDs); ;
- TransitPanel();
- ShowPanel();
- EnterEditMode();
- }
- public static void ShowRatePanel(bool belongSelf, GetFashionShowData data)
- {
- BelongSelf = belongSelf;
- FashionShowData = data;
- CloseIDs = data.GetCloseIds();
- //CloseNames = Player.DressIDToDressName(data.CloseIDs); ;
- Panel.TweenForVec();
- ShowPanel();
- EnterRateMode();
- }
- private static void ShowPanel()
- {
- DisplayPlayer = PlayerManager.Instance.GetRawPlayer();
- DisplayPlayer.transform.SetParent(DisplayBackground);
- DisplayPlayer.transform.SetSiblingIndex(1);
- DisplayPlayer.transform.localPosition = Vector3.zero;
- foreach (var closeID in CloseIDs)
- {
- CloseItem closeItem = PlayerManager.CloseItemDictionary[closeID];
- closeItem.ChangeDress(DisplayPlayer, false);
- }
- DelayCall.Call(1, () => { DisplayPlayer.DisplayInUI(37.5f, true);});
- DelayCall.Call(0.5f, () => { DisplayPlayer.ResetDepth(); });
- float cuteRate = FashionShowData.GetCuteRate();
- float gloryRate = FashionShowData.GetGloryRate();
- float graceRate = FashionShowData.GetGraceRate();
- float simpleRate = FashionShowData.GetSimpleRate();
- float vividRate = FashionShowData.GetVividRate();
- CuteSlider.value = cuteRate == 0 ? 1 : cuteRate;
- GlorySlider.value = cuteRate == 0 ? 1 : gloryRate;
- GraceSlider.value = cuteRate == 0 ? 1 : graceRate;
- SimpleSlider.value = cuteRate == 0 ? 1 : simpleRate;
- VividSlider.value = cuteRate == 0 ? 1 : vividRate;
- ShowRateValue();
- FashionTitleInputField.text = FashionShowData.title;
- FashionContentInputField.text = FashionShowData.content;
- RecommendTitle.text = Language.GetStr(LanguageLabel.UI__Pg_RecommendTitle).Replace(TransferLabel.Value, FashionShowData.playerNickName);
- HideRateButton();
- DisableRatePanel();
- for (int i = 0; i < CloseItems.Count; i++)
- {
- ResourceManager.Save(CloseItems[i].Transform);
- }
- CloseItems = new List<FashionShowCloseItem>();
- foreach (var closeID in CloseIDs)
- {
- if (PlayerManager.CloseItemDictionary[closeID].Sprites == null) continue;
- if (PlayerManager.CloseItemDictionary[closeID].ArmatureName == "Empty") continue;
- Transform itemTrans = ResourceManager.Get(ResourceLabel.FashionShowCloseItem, Folder.UI, false, FashionShowCloseGrid, false, ObjType.FashionShowCloseItem);
- FashionShowCloseItem item = new FashionShowCloseItem();
- item.Init(closeID, itemTrans);
- CloseItems.Add(item);
- }
- }
- private static void ShowRateValue()
- {
- CuteSlider.value = 3;
- GlorySlider.value = 3;
- GraceSlider.value = 3;
- SimpleSlider.value = 3;
- VividSlider.value = 3;
- CuteValue.text = FashionShowData.cuteScore == 0 ? "--" : FashionShowData.GetCuteRate().ToString("0.0");
- GloryValue.text = FashionShowData.gloryScore == 0 ? "--" : FashionShowData.GetGloryRate().ToString("0.0");
- GraceValue.text = FashionShowData.graceScore == 0 ? "--" : FashionShowData.GetGraceRate().ToString("0.0");
- SimpleValue.text = FashionShowData.simpleScore == 0 ? "--" : FashionShowData.GetSimpleRate().ToString("0.0");
- VividValue.text = FashionShowData.vividScore == 0 ? "--" : FashionShowData.GetVividRate().ToString("0.0");
- }
- private static void TransitPanel()
- {
- //Renderer renderer = PlayerManager.Player.HeadSlot.UnityTransform.GetComponentInChildren<Renderer>(true);
- //PlayerTween = AnimManager.CreateTweenRenderer(renderer, 0, 1, 0.25f, false, true, Curve.EaseOutQuad);
- //PlayerTween.UseSharedMaterial = true;
- //PlayerTween.StartBackward();
- PlayerManager.Player.PlayFadeOutAnim();
- ChangeDressPanel.GetTweenCG().AddEventOnetime(EventType.BackwardFinish, () => { Panel.TweenForVec(); });
- ChangeDressPanel.TweenBacCG();
- }
- private static void EnterEditMode()
- {
- FashionTitleInputField.interactable = true;
- FashionContentInputField.interactable = true;
- if (FashionShowData.showId == -1)
- {
- DeleteButton.SetActive(false);
- }
- else
- {
- DeleteButton.SetActive(true);
- }
- SaveButton.SetActive(true);
- ResetButton.SetActive(true);
- PraiseButton.SetActive(false);
- ShareButton.SetActive(false);
- CommentButton.SetActive(false);
- DisplayEditButton.SetActive(false);
- FashionTitleEditButton.SetActive(true);
- FashionContentEditButton.SetActive(true);
- FashionTitleInputField.SetActive(true);
- FashionContentInputField.SetActive(true);
- BuyAllButton.SetActive(false);
- foreach (var closeItem in CloseItems)
- {
- closeItem.BoxButton.interactable = false;
- closeItem.Text.SetActive(false);
- }
- UpdateTotalCost(false);
- }
- private static void EnterRateMode()
- {
- FashionTitleInputField.interactable = false;
- FashionContentInputField.interactable = false;
- DeleteButton.SetActive(false);
- SaveButton.SetActive(false);
- ResetButton.SetActive(false);
- PraiseButton.SetActive(true);
- RefreshPraiseButton();
- ShareButton.SetActive(true);
- CommentButton.SetActive(true);
- DisplayEditButton.SetActive(BelongSelf);
- FashionTitleEditButton.SetActive(false);
- FashionContentEditButton.SetActive(false);
- FashionTitleInputField.SetActive(false);
- FashionContentInputField.SetActive(false);
- if (FashionShowData.rated == false)
- {
- ShowRateButton();
- }
- bool haveUnboughtClose = false;
- foreach (var closeItem in CloseItems)
- {
- if (closeItem.CloseItem.IsBought)
- {
- closeItem.Text.SetActive(true);
- }
- else
- {
- closeItem.Text.SetActive(false);
- closeItem.BoxButton.interactable = true;
- haveUnboughtClose = true;
- }
- }
- BuyAllButton.SetActive(haveUnboughtClose);
- UpdateTotalCost(true);
- }
- public static void HidePanel()
- {
- if (LeaveToRateMode)
- {
- EnterRateMode();
- LeaveToRateMode = false;
- }
- else if (LeaveToHomePage)
- {
- DisplayPlayer.DisplayInScene();
- ResourceManager.Save(DisplayPlayer);
- Panel.GetTweenVec().AddEventOnetime(EventType.BackwardFinish, () => { FashionShowHomePage.ShowSidePanel(); });
- Panel.TweenBacVec();
- LeaveToHomePage = false;
- }
- else
- {
- DestroyImmediate(DisplayPlayer.gameObject);
- //DisplayPlayer.DisplayInScene();
- //ResourceManager.Save(DisplayPlayer);
- //if (PlayerTween != null)
- //{
- // PlayerTween.StartForward();
- //}
- PlayerManager.Player.PlayFadeInAnim();
- Panel.GetTweenVec().AddEventOnetime(EventType.BackwardFinish, () => { ChangeDressPanel.TweenForCG(); });
- Panel.TweenBacVec();
- }
- }
- public static void UpdateTotalCost(bool excludeBought)
- {
- List<KV<Current, KV<int, double>>> costKvs = CloseItem.GetTotalBuyCost(excludeBought, CloseIDs);
- foreach (var costKv in costKvs)
- {
- if (costKv.Key == Current.Coin) TotalCoin = costKv.Value;
- if (costKv.Key == Current.Diamond) TotalDiamond = costKv.Value;
- }
- CloseTotalCoinText.text = Auxiliary.ShrinkBigNumberStr(TotalCoin.Value);
- CloseTotalDiamondText.text = Auxiliary.ShrinkBigNumberStr(TotalDiamond.Value);
- }
- private static void OnReturnButtonClick()
- {
- AudioManager.PlayClip(ResourceLabel.BtnClip);
- HidePanel();
- }
- private static void OnPraiseButtonClick()
- {
- AudioManager.PlayClip(ResourceLabel.BtnClip);
- FashionShowData.praised = !FashionShowData.praised;
- if (FashionShowData.praised)
- {
- FashionShowData.praiseCnt++;
- }
- else
- {
- FashionShowData.praiseCnt--;
- }
- RefreshPraiseButton();
- PraiseShowHttp.Praise(HttpManager.GetPlayerId(), FashionShowData.showId, null, null);
- }
- private static void RefreshPraiseButton()
- {
- if (FashionShowData.praised)
- {
- PraiseButton.image.color = Lib.Pink;
- }
- else
- {
- PraiseButton.image.color = Color.white;
- }
- PraiseText.text = FashionShowData.praiseCnt.ToString();
- }
- private static void OnCommentButtonClick()
- {
- AudioManager.PlayClip(ResourceLabel.BtnClip);
- FashionShowCommentPanel.ShowPanel(FashionShowData);
- }
- private static void OnShareButtonClick()
- {
- AudioManager.PlayClip(ResourceLabel.BtnClip);
- }
- private static void OnDisplayEditButtonClick()
- {
- AudioManager.PlayClip(ResourceLabel.BtnClip);
- LeaveToRateMode = true;
- EnterEditMode();
- }
- private static void OnSaveButtonClick()
- {
- AudioManager.PlayClip(ResourceLabel.BtnClip);
- if (string.IsNullOrEmpty(FashionTitleInputField.text))
- {
- Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_EmptyTitle));
- return;
- }
- if (string.IsNullOrEmpty(FashionContentInputField.text))
- {
- Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_EmptyContent));
- return;
- }
- if (StringFilter.ContainSensitiveWord(FashionTitleInputField.text))
- {
- Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_BadTitle));
- return;
- }
- if (StringFilter.ContainSensitiveWord(FashionContentInputField.text))
- {
- Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_BadContent));
- return;
- }
- if (FashionShowData.playerNickName == FashionTitleInputField.text && FashionShowData.content == FashionContentInputField.text)
- {
- Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_RepeatData));
- return;
- }
- SaveButton.interactable = false;
- GetFashionShowData data = new GetFashionShowData(FashionShowData);
- data.title = FashionTitleInputField.text;
- data.content = FashionContentInputField.text;
- if (data.showId == -1)
- {
- AddShowHttp.Add(data, OnAddSucceedCallback, OnAddFailedCallback);
- }
- else
- {
- ModifyShowHttp.Modify(data, OnModifySucceedCallback, OnModifyFailedCallback);
- }
- }
- private static void OnAddFailedCallback()
- {
- SaveButton.interactable = true;
- Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_SaveFailed));
- }
- private static void OnAddSucceedCallback(object obj)
- {
- GetFashionShowData fashionShowData = (GetFashionShowData) obj;
- FashionShowData.showId = fashionShowData.showId;
- FashionShowData.title = fashionShowData.title;
- FashionShowData.content = fashionShowData.content;
- SaveButton.interactable = true;
- Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_SaveSucceed));
- DeleteButton.SetActive(true);
- }
- private static void OnModifyFailedCallback()
- {
- SaveButton.interactable = true;
- Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_SaveFailed));
- }
- private static void OnModifySucceedCallback(object obj)
- {
- GetFashionShowData fashionShowData = (GetFashionShowData)obj;
- FashionShowData.title = fashionShowData.title;
- FashionShowData.content = fashionShowData.content;
- SaveButton.interactable = true;
- Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_SaveSucceed));
- }
- private static void OnResetButtonClick()
- {
- AudioManager.PlayClip(ResourceLabel.BtnClip);
- FashionTitleInputField.text = FashionShowData.title;
- FashionContentInputField.text = FashionShowData.content;
- }
- private static void OnDeleteButtonClick()
- {
- Bubble.Show
- (
- null,
- Language.GetStr(LanguageLabel.UI__Pg_DeleteWarning),
- null,
- null,
- () =>
- {
- HidePanel();
- HidePanel();
- long playerId = HttpManager.GetPlayerId();
- DeleteShowHttp.Delete(playerId, FashionShowData.showId, null, null);
- //HttpManager.DeleteFashionShowData();
- }
- );
- }
- private static void OnBuyAllButtonClick()
- {
- //Debug.Log(TotalCoin.Value);
- UpdateTotalCost(true);
- if (TotalCoin.Value > Manager.Coin)
- {
- Bubble.Show(null, Language.GetStr(LanguageLabel.Common__ShortCoin));
- return;
- }
- if (TotalDiamond.Value > Manager.Diamond)
- {
- Bubble.Show(null, Language.GetStr(LanguageLabel.Common__ShortDiamond));
- return;
- }
- ShowBuyTip();
- }
- private static void ShowBuyTip()
- {
- Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pi_BuyAllTip), null, null,
- () =>
- {
- Manager.Pay("", TotalCoin.Value, Current.Coin, OnBuyAllSucceedCallback, StaticsManager.ItemID.解锁服装, StaticsManager.ConsumeModule.Charge, false, false, null, TotalCoin.Key);
- Manager.Pay("", TotalDiamond.Value, Current.Diamond, OnBuyAllSucceedCallback, StaticsManager.ItemID.解锁服装, StaticsManager.ConsumeModule.Charge, false, false, null, TotalDiamond.Key);
- }
- );
- }
- private static void OnBuyAllSucceedCallback()
- {
- foreach (var closeItem in CloseItems)
- {
- if (!closeItem.CloseItem.IsBought)
- {
- closeItem.CloseItem.OnBuySucceed();
- closeItem.Text.SetActive(true);
- }
- }
- }
- private static void OnRateButtonClick()
- {
- HideRateButton();
- AudioManager.PlayClip(ResourceLabel.BtnClip);
- EnableRatePanel();
- }
- private static void OnSubmitRateClick()
- {
- if (IsRateChanged() == false)
- {
- Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_RateDidntChange));
- return;
- }
- SubmitRate();
- //ShowRateButton();
- AudioManager.PlayClip(ResourceLabel.BtnClip);
- DisableRatePanel();
- ShowRateValue();
- }
- private static void SubmitRate()
- {
- ShowRateData data = new ShowRateData();
- data.showId = FashionShowData.showId;
- data.playerId = HttpManager.GetPlayerId();
- data.cuteRate = (int) CuteSlider.value;
- data.vividRate = (int) VividSlider.value;
- data.simpleRate = (int) SimpleSlider.value;
- data.graceRate = (int) GraceSlider.value;
- data.gloryRate = (int) GlorySlider.value;
- RateShowHttp.Rate(data, null, null);
- FashionShowData.cuteScore += data.cuteRate;
- FashionShowData.vividScore += data.vividRate;
- FashionShowData.simpleScore += data.simpleRate;
- FashionShowData.graceScore += data.graceRate;
- FashionShowData.gloryScore += data.gloryRate;
- FashionShowData.scoreCnt++;
- }
- private static bool IsRateChanged()
- {
- if (CuteValue.text == "--")
- return false;
- if (VividValue.text == "--")
- return false;
- if (GloryValue.text == "--")
- return false;
- if (GraceValue.text == "--")
- return false;
- if (SimpleValue.text == "--")
- return false;
- return true;
- }
- private static void OnResetRateClick()
- {
- ShowRateButton();
- AudioManager.PlayClip(ResourceLabel.BtnClip);
- DisableRatePanel();
- ShowRateValue();
- }
- private static void ShowRateButton()
- {
- RateButton.SetActive(true);
- rateButtonAnim.Resume();
- }
- private static void HideRateButton()
- {
- RateButton.SetActive(false);
- rateButtonAnim.Pause();
- }
- private static void EnableRatePanel()
- {
- SubmitRateButton.SetActive(true);
- ResetRateButton.SetActive(true);
- CuteSliderBg.SetActive(true);
- GlorySliderBg.SetActive(true);
- GraceSliderBg.SetActive(true);
- SimpleSliderBg.SetActive(true);
- VividSliderBg.SetActive(true);
- CuteSlider.interactable = true;
- GlorySlider.interactable = true;
- GraceSlider.interactable = true;
- SimpleSlider.interactable = true;
- VividSlider.interactable = true;
- CuteSlider.value = 0;
- GlorySlider.value = 0;
- SimpleSlider.value = 0;
- VividSlider.value = 0;
- GraceSlider.value = 0;
- CuteValue.text = "--";
- GloryValue.text = "--";
- GraceValue.text = "--";
- SimpleValue.text = "--";
- VividValue.text = "--";
- }
- private static void DisableRatePanel()
- {
- SubmitRateButton.SetActive(false);
- ResetRateButton.SetActive(false);
- CuteSliderBg.SetActive(false);
- GlorySliderBg.SetActive(false);
- GraceSliderBg.SetActive(false);
- SimpleSliderBg.SetActive(false);
- VividSliderBg.SetActive(false);
- CuteSlider.interactable = false;
- GlorySlider.interactable = false;
- GraceSlider.interactable = false;
- SimpleSlider.interactable = false;
- VividSlider.interactable = false;
- }
- private static void OnCuteSliderValueChange(float value)
- {
- //AudioManager.PlayClip(ResourceLabel.BtnClip);
- CuteRateText.text = value.ToString("0");
- CuteValue.text = value.ToString("0");
- }
- private static void OnCuteSliderSelect()
- {
- CuteRateBackground.SetActive(true);
- }
- private static void OnCuteSliderDeselect()
- {
- CuteRateBackground.SetActive(false);
- }
- private static void OnGraceSliderValueChange(float value)
- {
- //AudioManager.PlayClip(ResourceLabel.BtnClip);
- GraceRateText.text = value.ToString("0");
- GraceValue.text = value.ToString("0");
- }
- private static void OnGraceSliderSelect()
- {
- GraceRateBackground.SetActive(true);
- }
- private static void OnGraceSliderDeselect()
- {
- GraceRateBackground.SetActive(false);
- }
- private static void OnVividSliderValueChange(float value)
- {
- //AudioManager.PlayClip(ResourceLabel.BtnClip);
- VividRateText.text = value.ToString("0");
- VividValue.text = value.ToString("0");
- }
- private static void OnVividSliderSelect()
- {
- VividRateBackground.SetActive(true);
- }
- private static void OnVividSliderDeselect()
- {
- VividRateBackground.SetActive(false);
- }
- private static void OnSimpleSliderValueChange(float value)
- {
- //AudioManager.PlayClip(ResourceLabel.BtnClip);
- SimpleRateText.text = value.ToString("0");
- SimpleValue.text = value.ToString("0");
- }
- private static void OnSimpleSliderSelect()
- {
- SimpleRateBackground.SetActive(true);
- }
- private static void OnSimpleSliderDeselect()
- {
- SimpleRateBackground.SetActive(false);
- }
- private static void OnGlorySliderValueChange(float value)
- {
- //AudioManager.PlayClip(ResourceLabel.BtnClip);
- GloryRateText.text = value.ToString("0");
- GloryValue.text = value.ToString("0");
- }
- private static void OnGlorySliderSelect()
- {
- GloryRateBackground.SetActive(true);
- }
- private static void OnGlorySliderDeselect()
- {
- GloryRateBackground.SetActive(false);
- }
- private static void OnLevelChange(int level)
- {
- //GardenFashionShowButtonParent.SetActive(false);
- //DressroomFashionShowButton.SetActive(false);
- if (level >= UnlockLevel)
- {
- GardenFashionShowButtonParent.SetActive(true);
- DressroomFashionShowButton.SetActive(true);
- }
- else
- {
- GardenFashionShowButtonParent.SetActive(false);
- DressroomFashionShowButton.SetActive(false);
- }
- }
- private static void OnDressroomFashionShowButtonClick()
- {
- AudioManager.PlayClip(ResourceLabel.BtnClip);
- GetFashionShowData data = new GetFashionShowData();
- data.showId = -1;
- data.cuteScore = 0;
- data.gloryScore = 0;
- data.graceScore = 0;
- data.simpleScore = 0;
- data.vividScore = 0;
- data.title = "";
- data.content = "";
- data.playerId = HttpManager.GetPlayerId();
- data.playerNickName = NickNameManager.NickName;
- List<int> closeIds = PlayerManager.Player.GetCurrentChangableDressIDs();
- data.SetCloseIds(closeIds);
- ShowEditPanel(data);
- }
- }
|