1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- using System;
- using UnityEngine;
- using UnityEngine.UI;
- using System.Collections;
- using System.Collections.Generic;
- using Random = UnityEngine.Random;
- public class CommentItem : Regist
- {
- public Text Tit;
- public Text VisitLab;
- public Button VisitBtn;
- public BestfitText ContentLab;
- public string Content;
- public string SerialNumber;
- public override bool RegistImmed()
- {
- if (base.RegistImmed())
- {
- return true;
- }
- Dictionary<string, Transform> childDic = new Dictionary<string, Transform>();
- Auxiliary.CompileDic(transform, childDic);
- Tit = childDic["Tit"].GetComponent<Text>();
- VisitLab = childDic["VisitLab"].GetComponent<Text>();
- VisitBtn = childDic["VisitBtn"].GetComponent<Button>();
- ContentLab = childDic["ContentLab"].GetComponent<BestfitText>();
- ContentLab.VerticalMaxSize = 20;
- VisitLab.text = ManaReso.Get<Text>("C_CostLab").text;
- VisitBtn.onClick.AddListener(Visit);
- ManaCenter.OnLevelChange += () =>
- {
- VisitLab.text = ManaReso.Get<Text>("C_CostLab").text;
- };
- return false;
- }
- public void Visit()
- {
- ManaSocial.CloseCommentPanel();
- ManaSocial.RecordCommentPanel();
- ManaVisit.Visit(ArchiveSource.SerialNumber, SerialNumber);
- }
- public void Reset(string serialNumber, string content)
- {
- Content = content;
- SerialNumber = serialNumber;
- try
- {
- Tit.text = "****" + serialNumber.Substring(serialNumber.Length - 4);
- }
- catch (Exception)
- {
- Tit.text = "****" + Random.Range(1000, 10000);
- Debug.LogWarning("Error " + serialNumber);
- }
- ContentLab.text = content;
- }
- }
|