123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- using UnityEngine;
- using UnityEngine.UI;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using Random = UnityEngine.Random;
- public class RanktemLabel
- {
- public static string Title = "Title";
- public static string TitleBK = "TitleBK";
- public static string VisitText = "VisitText";
- public static string PraiseText = "PraiseText";
- public static string VisitBtn = "VisitBtn";
- public static string ContentText = "ContentText";
- }
- public class Ranktem : Regist
- {
- public Text Title;
- public Text VisitText;
- public Text PraiseText;
- public Text ContentText;
- public Image TitleBK;
- public Button VisitBtn;
- public int Rank;
- public int Praise;
- public string SerialNumber;
- public override bool InitAtOnce()
- {
- if (base.InitAtOnce())
- {
- return true;
- }
- Dictionary<string, Transform> childDic = new Dictionary<string, Transform>();
- Auxiliary.CompileDic(transform, childDic);
- Title = childDic[RanktemLabel.Title].GetComponent<Text>();
- TitleBK = childDic[RanktemLabel.TitleBK].GetComponent<Image>();
- VisitText = childDic[RanktemLabel.VisitText].GetComponent<Text>();
- PraiseText = childDic[RanktemLabel.PraiseText].GetComponent<Text>();
- VisitBtn = childDic[RanktemLabel.VisitBtn].GetComponent<Button>();
- ContentText = childDic[RanktemLabel.ContentText].GetComponent<Text>();
- VisitText.text = ResourceManager.Get<Text>(ObjectLabel.C_CostLab).text;
- VisitBtn.onClick.AddListener(Visit);
- Manager.OnLevelChange += (level) =>
- {
- VisitText.text = ResourceManager.Get<Text>(ObjectLabel.C_CostLab).text;
- };
- return false;
- }
- public void Visit()
- {
- SocialManager.CloseRankPanel();
- SocialManager.RecordRankPanel();
- VisitManager.Visit(ConfigSource.SerialNumber, SerialNumber);
- }
- public void Reset(string rank, string praise, string serialNumber)
- {
- Rank = int.Parse(rank);
- Praise = int.Parse(praise);
- SerialNumber = serialNumber;
- Title.text = rank;
- PraiseText.text = praise;
- ContentText.text = "******" + serialNumber.Substring(serialNumber.Length - 4);
- if (Rank == 1)
- {
- TitleBK.color = Lib.FirstRank;
- }
- else if (Rank == 2)
- {
- TitleBK.color = Lib.SecondRank;
- }
- else if (Rank == 3)
- {
- TitleBK.color = Lib.ThirdRank;
- }
- else
- {
- TitleBK.color = Lib.NormalRank;
- }
- if (SerialNumber == HttpManager.SerialNumber)
- {
- VisitBtn.SetActive(false);
- }
- }
- }
|