123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- using UnityEngine;
- using UnityEngine.UI;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using Random = UnityEngine.Random;
- public class Ranktem : Regist
- {
- public Text Tit;
- public Text VisitLab;
- public Text PraiseLab;
- public Text ContentLab;
- public Image TitBK;
- 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);
- Tit = childDic["Tit"].GetComponent<Text>();
- TitBK = childDic["TitBK"].GetComponent<Image>();
- VisitLab = childDic["VisitLab"].GetComponent<Text>();
- PraiseLab = childDic["PraiseLab"].GetComponent<Text>();
- VisitBtn = childDic["VisitBtn"].GetComponent<Button>();
- ContentLab = childDic["ContentLab"].GetComponent<Text>();
- VisitLab.text = ResourceManager.Get<Text>(ObjectLabel.C_CostLab).text;
- VisitBtn.onClick.AddListener(Visit);
- Manager.OnLevelChange += () =>
- {
- VisitLab.text = ResourceManager.Get<Text>(ObjectLabel.C_CostLab).text;
- };
- return false;
- }
- public void Visit()
- {
- SocialManager.CloseRankPanel();
- SocialManager.RecordRankPanel();
- VisitManager.Visit(ArchiveSource.SerialNumber, SerialNumber);
- }
- public void Reset(string rank, string praise, string serialNumber)
- {
- Rank = int.Parse(rank);
- Praise = int.Parse(praise);
- SerialNumber = serialNumber;
- Tit.text = rank;
- PraiseLab.text = praise;
- ContentLab.text = "******" + serialNumber.Substring(serialNumber.Length - 4);
- if (Rank == 1)
- {
- TitBK.color = Lib.FirstRank;
- }
- else if (Rank == 2)
- {
- TitBK.color = Lib.SecondRank;
- }
- else if (Rank == 3)
- {
- TitBK.color = Lib.ThirdRank;
- }
- else
- {
- TitBK.color = Lib.NormalRank;
- }
- if (SerialNumber == HttpManager.SerialNumber)
- {
- VisitBtn.SetActive(false);
- }
- }
- }
|