|
@@ -17,6 +17,7 @@ public class CommentItemLabel
|
|
|
public static string AddFriendButtonTitle = "AddFriendButtonTitle";
|
|
|
public static string SendMessageButton = "SendMessageButton";
|
|
|
public static string SendMessageButtonTitle = "SendMessageButtonTitle";
|
|
|
+ public static string NewMessageFlagImage = "NewMessageFlagImage";
|
|
|
}
|
|
|
|
|
|
public class CommentData
|
|
@@ -68,13 +69,14 @@ public class CommentItem : Regist
|
|
|
public Text ContentText;
|
|
|
public Text AddFriendButtonTitle;
|
|
|
public Text SendMessageButtonTitle;
|
|
|
+ public Image NewMessageFlagImage;
|
|
|
public Button VisitButton;
|
|
|
public Button AddFriendButton;
|
|
|
public Button SendMessageButton;
|
|
|
public BestfitText VisitButtonTitle;
|
|
|
|
|
|
public string Content;
|
|
|
- public string SerialNumber;
|
|
|
+ public AccountData AccountData;
|
|
|
|
|
|
#endregion
|
|
|
|
|
@@ -93,6 +95,7 @@ public class CommentItem : Regist
|
|
|
ContentText = childDic[CommentItemLabel.VisitButtonTitle].GetComponent<Text>();
|
|
|
AddFriendButtonTitle = childDic[CommentItemLabel.AddFriendButtonTitle].GetComponent<Text>();
|
|
|
SendMessageButtonTitle = childDic[CommentItemLabel.SendMessageButtonTitle].GetComponent<Text>();
|
|
|
+ NewMessageFlagImage = childDic[CommentItemLabel.NewMessageFlagImage].GetComponent<Image>();
|
|
|
VisitButton = childDic[CommentItemLabel.VisitButton].GetComponent<Button>();
|
|
|
AddFriendButton = childDic[CommentItemLabel.AddFriendButton].GetComponent<Button>();
|
|
|
SendMessageButton = childDic[CommentItemLabel.SendMessageButton].GetComponent<Button>();
|
|
@@ -106,12 +109,15 @@ public class CommentItem : Regist
|
|
|
|
|
|
VisitButton.onClick.AddListener(Visit);
|
|
|
AddFriendButton.onClick.AddListener(OnAddFriendButtonClick);
|
|
|
+ SendMessageButton.onClick.AddListener(OnSendMessageButtonClick);
|
|
|
|
|
|
Manager.OnLevelChange += level =>
|
|
|
{
|
|
|
ContentText.text = ResourceManager.Get<Text>(ObjectLabel.C_CostLab).text;
|
|
|
};
|
|
|
|
|
|
+ FriendPanel.OnFriendListRefresh += RefreshRelationship;
|
|
|
+
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -119,15 +125,17 @@ public class CommentItem : Regist
|
|
|
{
|
|
|
SocialManager.CloseCommentPanel();
|
|
|
SocialManager.RecordCommentPanel();
|
|
|
- VisitManager.Visit(ConfigSource.SerialNumber, SerialNumber);
|
|
|
+ VisitManager.Visit(ConfigSource.SerialNumber, AccountData.SerialNumber);
|
|
|
}
|
|
|
|
|
|
- public void Reset(string nickname, string serialNumber, string content)
|
|
|
+ public void Reset(AccountData accountData, string content)
|
|
|
{
|
|
|
Content = content;
|
|
|
- SerialNumber = serialNumber;
|
|
|
+ AccountData = accountData;
|
|
|
|
|
|
- if (serialNumber == HttpManager.SerialNumber)
|
|
|
+ RefreshRelationship(FriendPanel.FriendAccountDatas);
|
|
|
+
|
|
|
+ if (accountData.SerialNumber == HttpManager.SerialNumber)
|
|
|
{
|
|
|
VisitButton.SetActive(false);
|
|
|
}
|
|
@@ -136,15 +144,15 @@ public class CommentItem : Regist
|
|
|
VisitButton.SetActive(true);
|
|
|
}
|
|
|
|
|
|
- if (!string.IsNullOrEmpty(nickname))
|
|
|
+ if (!string.IsNullOrEmpty(accountData.Nickname))
|
|
|
{
|
|
|
- Title.text = nickname;
|
|
|
+ Title.text = accountData.Nickname;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (Title.text.Length >= 4)
|
|
|
{
|
|
|
- Title.text = "****" + serialNumber.Substring(serialNumber.Length - 4);
|
|
|
+ Title.text = "****" + accountData.SerialNumber.Substring(accountData.SerialNumber.Length - 4);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -162,7 +170,7 @@ public class CommentItem : Regist
|
|
|
{
|
|
|
AudioManager.PlayClip(ResourceLabel.BtnClip);
|
|
|
AddFriendButton.interactable = false;
|
|
|
- HttpManager.ApplyBuddy(SerialNumber, SendApplySucceed, SendApplyFailed);
|
|
|
+ HttpManager.ApplyBuddy(AccountData.SerialNumber, SendApplySucceed, SendApplyFailed);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -180,17 +188,24 @@ public class CommentItem : Regist
|
|
|
}
|
|
|
|
|
|
|
|
|
- public void RefreshRelationship()
|
|
|
+ public void RefreshRelationship(List<AccountData> accountDatas)
|
|
|
{
|
|
|
- if (IsFriend())
|
|
|
+ if (IsFriend(accountDatas))
|
|
|
{
|
|
|
AddFriendButton.SetActive(false);
|
|
|
SendMessageButton.SetActive(true);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public bool IsFriend()
|
|
|
+ public bool IsFriend(List<AccountData> accountDatas)
|
|
|
+ {
|
|
|
+ return accountDatas.MyContains(item => AccountData.SerialNumber == item.SerialNumber);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public void OnSendMessageButtonClick()
|
|
|
{
|
|
|
- return FriendPanel.FriendItems.MyContains(item => AccountData.SerialNumber == item.AccountData.SerialNumber);
|
|
|
+ AudioManager.PlayClip(ResourceLabel.BtnClip);
|
|
|
+ MessagePanel.OpenPanel(AccountData);
|
|
|
}
|
|
|
}
|