178 lines
5.0 KiB
C#
178 lines
5.0 KiB
C#
using UnityEngine;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using GCGame.Table;
|
|
using Games.GlobeDefine;
|
|
|
|
public class SwornBrother
|
|
{
|
|
|
|
#region relation
|
|
|
|
public List<SwornMember> _MyBrothers = new List<SwornMember>();
|
|
private SwornMember _MySwornInfo;
|
|
public SwornMember MySwornInfo
|
|
{
|
|
get
|
|
{
|
|
return _MySwornInfo;
|
|
}
|
|
}
|
|
|
|
public bool IsMySwornBro(ulong guid)
|
|
{
|
|
if (_MyBrothers == null)
|
|
return false;
|
|
|
|
for (int i = 0; i < _MyBrothers.Count; ++i)
|
|
{
|
|
if (_MyBrothers[i].Guid == guid)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public void InitRelations(GC_RET_SWORN_USER_INFO packet)
|
|
{
|
|
_MyBrothers = new List<SwornMember>();
|
|
for (int i = 0; i < packet.swornMembersList.Count; ++i)
|
|
{
|
|
if (packet.swornMembersList[i].Guid == LoginData._LoadingRoleGuid)
|
|
{
|
|
_MySwornInfo = packet.swornMembersList[i];
|
|
}
|
|
else
|
|
{
|
|
_MyBrothers.Add(packet.swornMembersList[i]);
|
|
}
|
|
}
|
|
}
|
|
|
|
public string GetSwornCalling(ulong guid)
|
|
{
|
|
for (int i = 0; i < _MyBrothers.Count; ++i)
|
|
{
|
|
if (_MyBrothers[i].Guid == guid)
|
|
{
|
|
return GetSwornCalling(_MyBrothers[i]);
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
|
|
public string GetSwornCalling(SwornMember swornBro)
|
|
{
|
|
string rankStr = "";
|
|
switch (swornBro.Rank)
|
|
{
|
|
case 1:
|
|
rankStr = StrDictionary.GetClientDictionaryString("#{36200}");
|
|
break;
|
|
case 2:
|
|
rankStr = StrDictionary.GetClientDictionaryString("#{36201}");
|
|
break;
|
|
case 3:
|
|
rankStr = StrDictionary.GetClientDictionaryString("#{36202}");
|
|
break;
|
|
case 4:
|
|
rankStr = StrDictionary.GetClientDictionaryString("#{36203}");
|
|
break;
|
|
case 5:
|
|
rankStr = StrDictionary.GetClientDictionaryString("#{36204}");
|
|
break;
|
|
}
|
|
|
|
string relationStr = "";
|
|
if (swornBro.Rank < MySwornInfo.Rank)
|
|
{
|
|
if (GCGame.Utils.GetProfessionGender(swornBro.Profession) == GCGame.Utils.ChatGender.Female)
|
|
{
|
|
relationStr = StrDictionary.GetClientDictionaryString("#{36207}");
|
|
}
|
|
else
|
|
{
|
|
relationStr = StrDictionary.GetClientDictionaryString("#{36205}");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (GCGame.Utils.GetProfessionGender(swornBro.Profession) == GCGame.Utils.ChatGender.Female)
|
|
{
|
|
relationStr = StrDictionary.GetClientDictionaryString("#{36208}");
|
|
}
|
|
else
|
|
{
|
|
relationStr = StrDictionary.GetClientDictionaryString("#{36206}");
|
|
}
|
|
}
|
|
|
|
return rankStr + relationStr;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region
|
|
|
|
private string _SettingCommonTitle;
|
|
private string _SettingSelfTitle;
|
|
|
|
public void ShowBroBirth()
|
|
{
|
|
List<string> teamMemberNames = new List<string>();
|
|
foreach (var teamInfo in GameManager.gameManager.PlayerDataPool.TeamInfo.teamMember)
|
|
{
|
|
if (teamInfo.IsValid() && teamInfo.MemberName != Singleton<ObjManager>.GetInstance().MainPlayer.BaseAttr.RoleName)
|
|
{
|
|
teamMemberNames.Add(teamInfo.MemberName);
|
|
}
|
|
}
|
|
SwornBroBirthRoot.ShowSwornBirth(teamMemberNames);
|
|
}
|
|
|
|
public void ShowBroCommonTitleInput()
|
|
{
|
|
SwornBroTitleInputRoot.ShowCommonTitleInput(GetCommonTitleInput);
|
|
}
|
|
|
|
private void GetCommonTitleInput(string title)
|
|
{
|
|
if (string.IsNullOrEmpty(title))
|
|
return;
|
|
|
|
_SettingCommonTitle = title;
|
|
MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{36104}", title), "", SetCommonTitleOK);
|
|
}
|
|
|
|
private void SetCommonTitleOK()
|
|
{
|
|
CG_SET_SWORN_COMMON_TITLE packet = (CG_SET_SWORN_COMMON_TITLE)PacketDistributed.CreatePacket(MessageID.PACKET_CG_SET_SWORN_COMMON_TITLE);
|
|
packet.SetName(_SettingCommonTitle);
|
|
packet.SendPacket();
|
|
}
|
|
|
|
public void ShowBroSelfTitleInput()
|
|
{
|
|
SwornBroTitleInputRoot.ShowSelfTitleInput(GetSelfTitleInput);
|
|
}
|
|
|
|
private void GetSelfTitleInput(string title)
|
|
{
|
|
if (string.IsNullOrEmpty(title))
|
|
return;
|
|
|
|
_SettingSelfTitle = title;
|
|
MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{36106}", _SettingSelfTitle), "", SetSelfTitleOK);
|
|
}
|
|
|
|
private void SetSelfTitleOK()
|
|
{
|
|
string selfTitle = StrDictionary.GetClientDictionaryString("#{36102}") + _SettingSelfTitle;
|
|
CG_SET_SWORN_SELF_TITLE packet = (CG_SET_SWORN_SELF_TITLE)PacketDistributed.CreatePacket(MessageID.PACKET_CG_SET_SWORN_SELF_TITLE);
|
|
packet.SetName(selfTitle);
|
|
packet.SendPacket();
|
|
}
|
|
#endregion
|
|
}
|