131 lines
3.3 KiB
C#
131 lines
3.3 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using System.Collections;
|
|
using Games.Item;
|
|
using System.Collections.Generic;
|
|
using GCGame.Table;
|
|
using Games.GlobeDefine;
|
|
|
|
public class CommunityFwordingLogic : UIControllerBase<CommunityFwordingLogic>
|
|
{
|
|
public ChatInputLogic _FwordInput;
|
|
public Image _Icon;
|
|
public Image _Checking;
|
|
public Text _Name;
|
|
public ChatContex _BlogContex;
|
|
public Text _FwordStr;
|
|
public ChatContex _ChatContex;
|
|
|
|
private CommunityBlogInfo _FwordBlog;
|
|
private string _DefaultFwordStr;
|
|
private ChatLinkName _FwordNameLink;
|
|
|
|
private string _DefaultEmptyStr;
|
|
|
|
|
|
void OnEnable ()
|
|
{
|
|
SetInstance(this);
|
|
}
|
|
|
|
void OnDisable()
|
|
{
|
|
SetInstance(null);
|
|
}
|
|
|
|
public void ShowWindow()
|
|
{
|
|
gameObject.SetActive(true);
|
|
}
|
|
|
|
public void ShowFwordingWin(CommunityBlogInfo blog, NetImage netImage)
|
|
{
|
|
ShowWindow();
|
|
_FwordBlog = blog;
|
|
|
|
_Icon.sprite = netImage._Image.sprite;
|
|
if (netImage._ImageChecking.IsActive())
|
|
{
|
|
_Checking.gameObject.SetActive(true);
|
|
_Checking.sprite = netImage._ImageChecking.sprite;
|
|
}
|
|
else
|
|
{
|
|
_Checking.gameObject.SetActive(false);
|
|
}
|
|
|
|
if (blog.ForwardingBlog != null)
|
|
{
|
|
_Name.text = _FwordBlog.ForwardingBlog.Name;
|
|
_BlogContex.ShowLinkStr(_FwordBlog.ForwardingBlog.Contex);
|
|
}
|
|
else
|
|
{
|
|
_Name.text = _FwordBlog.Name;
|
|
_BlogContex.ShowLinkStr(_FwordBlog.Contex);
|
|
}
|
|
|
|
_FwordNameLink = new ChatLinkName();
|
|
_FwordNameLink.SetLinkCharName(blog.Name, blog.RoleGuid);
|
|
|
|
_DefaultFwordStr = "";
|
|
if (blog.ForwardingBlog != null)
|
|
{
|
|
_DefaultFwordStr = "//" + _FwordNameLink.StrSend + blog.Contex;
|
|
}
|
|
_DefaultEmptyStr = StrDictionary.GetClientDictionaryString("#{39022}");
|
|
|
|
OnInputStr();
|
|
}
|
|
|
|
public void CloseWindow()
|
|
{
|
|
gameObject.SetActive(false);
|
|
}
|
|
|
|
public void OnBtnSend(string sendStr)
|
|
{
|
|
string modifiedStr = sendStr + _DefaultFwordStr;
|
|
|
|
CG_REQ_REPRINT_BLOG packet = (CG_REQ_REPRINT_BLOG)PacketDistributed.CreatePacket(MessageID.PACKET_CG_REQ_REPRINT_BLOG);
|
|
|
|
for (int i = 0; i < _FwordBlog.ContexImageUrls.Count; ++i)
|
|
{
|
|
packet.AddImgnames(_FwordBlog.ContexImageUrls[i]);
|
|
}
|
|
|
|
if (_FwordBlog.ForwardingBlog == null)
|
|
{
|
|
packet.Context = _FwordBlog.Contex;
|
|
packet.Reprintblogguid = _FwordBlog.GUID;
|
|
packet.Reprintroleguid = _FwordBlog.RoleGuid;
|
|
|
|
}
|
|
else
|
|
{
|
|
packet.Context = _FwordBlog.ForwardingBlog.Contex;
|
|
packet.Reprintblogguid = _FwordBlog.GUID;
|
|
packet.Reprintroleguid = _FwordBlog.ForwardingBlog.RoleGuid;
|
|
|
|
}
|
|
|
|
packet.Reprintcomment = modifiedStr;
|
|
packet.SendPacket();
|
|
CloseWindow();
|
|
|
|
//CommunityBlogPageLogic.Instance().BackToMain();
|
|
}
|
|
|
|
public void OnInputStr()
|
|
{
|
|
string inputStr = _FwordInput._InputText.text;
|
|
if (string.IsNullOrEmpty(inputStr))
|
|
{
|
|
inputStr = StrDictionary.GetClientDictionaryString("#{39022}");
|
|
}
|
|
|
|
_ChatContex.ShowLinkStr("<color=#00000000> " + inputStr + "</color>\n" + _DefaultFwordStr);
|
|
}
|
|
|
|
}
|