443 lines
16 KiB
C#
443 lines
16 KiB
C#
///
|
|
//拥有帮会后打开帮会显示的界面中的 信息分页
|
|
///
|
|
|
|
using Games.LogicObj;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using System.Collections;
|
|
using GCGame;
|
|
using Module.Log;
|
|
using Games.GlobeDefine;
|
|
using System.Collections.Generic;
|
|
using System;
|
|
using GCGame.Table;
|
|
|
|
public class SelfGuildInfoChildWnd : MonoBehaviour
|
|
{
|
|
public Text m_GuildName;
|
|
public Text m_Level;
|
|
public Text m_ID;
|
|
public Text m_Chief;
|
|
public Text m_Originator;
|
|
public Text m_MemberNum;
|
|
public Text m_Equip;
|
|
public Text m_Activity;
|
|
public Text m_TotleMoney;
|
|
public Text m_NeedPay;
|
|
public Text m_Houses;
|
|
public Text m_Chests;
|
|
public Text m_Librarys;
|
|
public Text m_Notice; //帮会宗旨
|
|
public Text m_lasetChangeNameTime; //上次改名字时间
|
|
public Text m_lasetName; //改名之前的名字
|
|
|
|
//改名字消耗
|
|
public Image iconQulity;
|
|
public Image iconPrice;
|
|
public Text Price;
|
|
public Text Name;
|
|
public Button GetBtn;
|
|
|
|
public GameObject m_changeNameWnd;
|
|
public GameObject m_changeZongzhiWnd;
|
|
|
|
public InputField m_changeName;
|
|
public InputField m_changZongzhi;
|
|
|
|
public bool NeedOpenChangeName = false;
|
|
|
|
public GameObject ResignBtn; //辞职按钮
|
|
|
|
void Awake()
|
|
{
|
|
Hashtable add = new Hashtable();
|
|
add["name"] = "guildInfoWnd";
|
|
Games.Events.MessageEventCallBack call = UpdateGuildInfo;
|
|
add["callFun"] = call;
|
|
Games.Events.EventDispatcher.Instance.AddMessageEvent(Games.Events.EventId.UpdateGuildInfo, add);
|
|
|
|
if (m_Notice != null)
|
|
m_Notice.text = StrDictionary.GetClientDictionaryString("#{25243}");
|
|
|
|
}
|
|
|
|
void OnEnable()
|
|
{
|
|
UpdateResignBtn();
|
|
CG_GUILD_REQ_INFO send = (CG_GUILD_REQ_INFO)PacketDistributed.CreatePacket(MessageID.PACKET_CG_GUILD_REQ_INFO);
|
|
send.SetReqType((int)CG_GUILD_REQ_INFO.REQ_TYPE.REQ_TYPE_INFO_LESS);
|
|
send.SendPacket();
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
Click_CloseChildWnd();
|
|
}
|
|
|
|
public void UpdateResignBtn()
|
|
{
|
|
if (Singleton<ObjManager>.Instance.MainPlayer != null)
|
|
{
|
|
int job = GameManager.gameManager.PlayerDataPool.GuildInfo.GuildJob;
|
|
|
|
ResignBtn.SetActive((job != -1) && (job <= (int)GameDefine_Globe.GUILD_JOB.ELITE));
|
|
}
|
|
}
|
|
|
|
void OnDestroy()
|
|
{
|
|
Games.Events.EventDispatcher.Instance.RemoveMessage(Games.Events.EventId.UpdateGuildInfo, "guildInfoWnd");
|
|
}
|
|
|
|
public void UpdateGuildInfo(Hashtable addParam,Hashtable sendParam)
|
|
{
|
|
if (NeedOpenChangeName)
|
|
Click_OPenChildChangeGuildName();
|
|
NeedOpenChangeName = false;
|
|
InitInfos();
|
|
UpdateResignBtn();
|
|
}
|
|
|
|
public void InitInfos()
|
|
{
|
|
Guild info = GameManager.gameManager.PlayerDataPool.GuildInfo;
|
|
if (info == null)
|
|
return;
|
|
if (m_GuildName != null)
|
|
m_GuildName.text = info.GuildName;
|
|
if (m_Level != null)
|
|
m_Level.text = info.GuildLevel.ToString();
|
|
if (m_ID != null)
|
|
m_ID.text = info.GuildGuid.ToString();
|
|
if (m_Chief != null)
|
|
m_Chief.text = info.GuildChiefName;
|
|
if (m_MemberNum != null)
|
|
m_MemberNum.text = string.Format("{0}/{1}", info.GuildCurMem, info.GuildMaxMem);
|
|
|
|
if (m_Originator != null)
|
|
m_Originator.text = info.GuildCreatorName;
|
|
if (m_Activity != null)
|
|
m_Activity.text = info.GuildExp.ToString();
|
|
if (m_Equip != null)
|
|
m_Equip.text = (info.GuildTotleCombat > 0 ? StrDictionary.GetClientDictionaryString("#{2972}", info.GuildTotleCombat) : "0");
|
|
if (m_NeedPay != null)
|
|
m_NeedPay.text = info.GuildPay.ToString();
|
|
if (m_TotleMoney != null)
|
|
m_TotleMoney.text = info.GuildMoney.ToString();
|
|
if (m_Chests != null)
|
|
{
|
|
int level = info.GetBuildLevel(Guild.BuildType.coin);
|
|
if(level == -1)
|
|
{
|
|
m_Chests.text = "";
|
|
}
|
|
else
|
|
{
|
|
m_Chests.text = level.ToString();
|
|
}
|
|
}
|
|
if (m_Houses != null)
|
|
{
|
|
int level = info.GetBuildLevel(Guild.BuildType.house);
|
|
if (level == -1)
|
|
{
|
|
m_Houses.text = "";
|
|
}
|
|
else
|
|
{
|
|
m_Houses.text = level.ToString();
|
|
}
|
|
}
|
|
if (m_Librarys != null)
|
|
{
|
|
int level = info.GetBuildLevel(Guild.BuildType.library);
|
|
if (level == -1)
|
|
{
|
|
m_Librarys.text = "";
|
|
}
|
|
else
|
|
{
|
|
m_Librarys.text = level.ToString();
|
|
}
|
|
}
|
|
}
|
|
|
|
//修改帮会名称
|
|
public void Click_OPenChildChangeGuildName()
|
|
{
|
|
if (GCGame.Utils.IsGuildPowerFull(9) == false)
|
|
return;
|
|
|
|
if (m_changeNameWnd != null)
|
|
{
|
|
Tab_GuildOther other = TableManager.GetGuildOtherByID(0, 0);
|
|
if(other!=null)
|
|
{
|
|
|
|
if (other.ChangeMoneyType <= 4)
|
|
{
|
|
if (ReliveLogic.MoneytypeNamesTableId.ContainsKey(other.ChangeMoneyType))
|
|
{
|
|
int id = ReliveLogic.MoneytypeNamesTableId[other.ChangeMoneyType];
|
|
|
|
Tab_StrDictionary TabStrDictionary = TableManager.GetStrDictionaryByID(id, 0);
|
|
if (TabStrDictionary != null)
|
|
{
|
|
Name.text = TabStrDictionary.StrDictionary;
|
|
}
|
|
}
|
|
LoadAssetBundle.Instance.SetImageSprite(iconQulity, Utils.GetItemQualityFrame(3));
|
|
LoadAssetBundle.Instance.SetImageSprite(iconPrice, UICurrencyItem.GetCurrencySprite((MONEYTYPE)other.ChangeMoneyType));
|
|
GetBtn.gameObject.SetActive(GameManager.gameManager.PlayerDataPool.Money.GetMoneyByType((MONEYTYPE)other.ChangeMoneyType) < other.ChangeNameNeedMoney);
|
|
GetBtn.onClick.RemoveAllListeners();
|
|
GetBtn.onClick.AddListener(delegate ()
|
|
{
|
|
JudgeMoneyLogic.ShowSwitchMoneyPanel((MONEYTYPE)other.ChangeMoneyType);
|
|
Click_CloseChildWnd();
|
|
});
|
|
Price.text = string.Format("<color=#{0}>{1}</color>/{2}",GetBtn.gameObject.activeSelf?"ff0000ff":"000000ff", GameManager.gameManager.PlayerDataPool.Money.GetMoneyByType((MONEYTYPE)other.ChangeMoneyType), other.ChangeNameNeedMoney);
|
|
}
|
|
else
|
|
{
|
|
Tab_CommonItem commonItem = TableManager.GetCommonItemByID(other.ChangeMoneyType, 0);
|
|
if (commonItem != null)
|
|
{
|
|
Name.text = commonItem.Name;
|
|
LoadAssetBundle.Instance.SetImageSprite(iconQulity, Utils.GetItemQualityFrame(commonItem.Quality));
|
|
LoadAssetBundle.Instance.SetImageSprite(iconPrice, commonItem.Icon);
|
|
GetBtn.gameObject.SetActive(other.ChangeNameNeedMoney > GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(other.ChangeMoneyType));
|
|
Price.text = string.Format("<color=#{0}>{1}</color>/{2}", GetBtn.gameObject.activeSelf ? "ff0000ff" : "000000ff", GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(other.ChangeMoneyType), other.ChangeNameNeedMoney);
|
|
GetBtn.onClick.RemoveAllListeners();
|
|
int itemID = other.ChangeMoneyType;
|
|
GetBtn.onClick.AddListener(delegate ()
|
|
{
|
|
Tab_ItemGetPath tab_ItemGetPath = TableManager.GetItemGetPathByID(itemID, 0);
|
|
if (tab_ItemGetPath == null)
|
|
return;
|
|
for (int i = 0; i < tab_ItemGetPath.getItemPathCount(); i++)
|
|
{
|
|
string pathInfo = tab_ItemGetPath.GetItemPathbyIndex(i);
|
|
if (string.IsNullOrEmpty(pathInfo) || pathInfo == "-1")
|
|
continue;
|
|
|
|
ItemGetPathPopRoot.GetPathData getPathData = new ItemGetPathPopRoot.GetPathData();
|
|
getPathData.pathType = i;
|
|
getPathData.info = pathInfo.Trim('"');
|
|
getPathData.itemID = itemID;
|
|
ItemGetPathPopRoot.GoGetPath(getPathData);
|
|
Click_CloseChildWnd();
|
|
return;
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
m_changeNameWnd.SetActive(true);
|
|
m_lasetName.text = GameManager.gameManager.PlayerDataPool.GuildInfo.GuildName;
|
|
if (GameManager.gameManager.PlayerDataPool.GuildInfo.LastChangeNameTime<=0)
|
|
{
|
|
m_lasetChangeNameTime.text = StrDictionary.GetClientDictionaryString("#{25124}");
|
|
}
|
|
else
|
|
{
|
|
DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
|
|
long lTime = long.Parse(GameManager.gameManager.PlayerDataPool.GuildInfo.LastChangeNameTime + "0000000");
|
|
TimeSpan toNow = new TimeSpan(lTime);
|
|
DateTime dtNow = dtStart.Add(toNow);
|
|
m_lasetChangeNameTime.text = StrDictionary.GetClientDictionaryString("#{25123}",dtNow.Year,dtNow.Month,dtNow.Day) + string.Format(" {0:#00}:{1:#00}:{2:#00}",dtNow.Hour,dtNow.Minute,dtNow.Second) ;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//修改帮会宗旨
|
|
public void Click_OpenChildChangeGuildZongzhi()
|
|
{
|
|
if (GCGame.Utils.IsGuildPowerFull(3) == false)
|
|
return;
|
|
|
|
if (m_changeZongzhiWnd != null)
|
|
m_changeZongzhiWnd.SetActive(true);
|
|
}
|
|
|
|
//打开帮会历程界面
|
|
public void Click_GuildGuildHistory()
|
|
{
|
|
UIManager.ShowUI(UIInfo.GuildHistory);
|
|
}
|
|
|
|
//打开生活技能
|
|
public void Click_LiveSkill()
|
|
{
|
|
UIManager.ShowUI(UIInfo.SkillInfo, delegate (bool bSuccess, object param)
|
|
{
|
|
if (SkillRootLogic.Instance() != null)
|
|
{
|
|
SkillRootLogic.Instance().ShowTagPage(2);
|
|
}
|
|
});
|
|
}
|
|
|
|
//回到帮会地图
|
|
public void Click_BackHomeGuild()
|
|
{
|
|
if (GameManager.gameManager.m_RunningScene == 658)
|
|
{
|
|
GUIData.AddNotifyData(GCGame.Table.StrDictionary.GetClientDictionaryString("#{79512}"));
|
|
return;
|
|
}
|
|
if (GameManager.gameManager.PlayerDataPool.IsHaveGuild() == false)
|
|
return;
|
|
Singleton<ObjManager>.Instance.MainPlayer.BackGuildMap(GameManager.gameManager.PlayerDataPool.GuildInfo.GuildGuid);
|
|
UIManager.CloseUI(UIInfo.GuildMainInfoWnd);
|
|
}
|
|
|
|
//修改帮会宗旨
|
|
public void Click_ChangeZongzhi()
|
|
{
|
|
return;
|
|
if (null == Singleton<ObjManager>.GetInstance().MainPlayer)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//判断帮会名称控件是否存在
|
|
if (null == m_changZongzhi)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//判断公告是否符合要求
|
|
if (string.IsNullOrEmpty(m_changZongzhi.text))
|
|
{
|
|
return;
|
|
}
|
|
|
|
int lenNotic = GCGame.Utils.StrCharLength(m_changZongzhi.text);
|
|
if (lenNotic > GlobeVar.MAX_GUILD_NOTICE || lenNotic < GlobeVar.MIN_GUILD_NOTICE)
|
|
{
|
|
Singleton<ObjManager>.GetInstance().MainPlayer.SendNoticMsg(false, "#{25121}");
|
|
return;
|
|
}
|
|
|
|
//屏蔽字检查
|
|
if (null != Utils.GetStrFilter(m_changZongzhi.text, (int)GameDefine_Globe.STRFILTER_TYPE.STRFILTER_NAME))
|
|
{
|
|
Singleton<ObjManager>.GetInstance().MainPlayer.SendNoticMsg(false, "#{1278}"); // 包含非法字符
|
|
return;
|
|
}
|
|
|
|
if (null != Singleton<ObjManager>.GetInstance().MainPlayer)
|
|
{
|
|
Singleton<ObjManager>.GetInstance().MainPlayer.ReqChangeGuildNotice(m_changZongzhi.text, (int)CG_GUILD_REQ_CHANGE_NOTICE.CHANGE_TYPE.CHANGE_TYPE_GUILDNOTICE);
|
|
}
|
|
if (m_changeZongzhiWnd != null)
|
|
m_changeZongzhiWnd.SetActive(false);
|
|
}
|
|
|
|
//修改帮会名称
|
|
public void Click_ChangeName()
|
|
{
|
|
if (null == Singleton<ObjManager>.GetInstance().MainPlayer)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//判断帮会名称控件是否存在
|
|
if (null == m_changeName)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//判断公告是否符合要求
|
|
if (string.IsNullOrEmpty(m_changeName.text))
|
|
{
|
|
return;
|
|
}
|
|
|
|
int lenName = GCGame.Utils.StrCharLength(m_changeName.text);
|
|
if (lenName > GlobeVar.MAX_GUILD_NAME || lenName < GlobeVar.MIN_GUILD_NAME)
|
|
{
|
|
Singleton<ObjManager>.GetInstance().MainPlayer.SendNoticMsg(false, "#{25120}");
|
|
return;
|
|
}
|
|
|
|
//屏蔽字检查
|
|
if (null != Utils.GetStrFilter(m_changeName.text, (int)GameDefine_Globe.STRFILTER_TYPE.STRFILTER_NAME))
|
|
{
|
|
Singleton<ObjManager>.GetInstance().MainPlayer.SendNoticMsg(false, "#{1278}"); // 包含非法字符
|
|
return;
|
|
}
|
|
|
|
Tab_GuildOther other = TableManager.GetGuildOtherByID(0, 0);
|
|
if (other != null)
|
|
{
|
|
Price.text = other.ChangeNameNeedMoney.ToString();
|
|
long have = 0;
|
|
if (other.ChangeMoneyType <= 4)
|
|
{
|
|
have = GameManager.gameManager.PlayerDataPool.Money.GetMoneyByType((MONEYTYPE)other.ChangeMoneyType);
|
|
}
|
|
else
|
|
{
|
|
have = GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(other.ChangeMoneyType);
|
|
}
|
|
if (other.ChangeNameNeedMoney > have)
|
|
{
|
|
int ItemId = other.ChangeMoneyType;
|
|
MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{25248}"),null,delegate ()
|
|
{
|
|
|
|
ItemGetPathPopRoot.Show(ItemId,Vector2.zero);
|
|
|
|
}, null);
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (null != Singleton<ObjManager>.GetInstance().MainPlayer)
|
|
{
|
|
Singleton<ObjManager>.GetInstance().MainPlayer.ReqChangeGuildNotice(m_changeName.text, (int)CG_GUILD_REQ_CHANGE_NOTICE.CHANGE_TYPE.CHANGE_TYPE_GUILDNAME);
|
|
}
|
|
if (m_changeNameWnd != null)
|
|
m_changeNameWnd.SetActive(false);
|
|
}
|
|
|
|
//帮会招募
|
|
public void Conscribe()
|
|
{
|
|
if (GameManager.gameManager.m_RunningScene == 658)
|
|
{
|
|
GUIData.AddNotifyData(GCGame.Table.StrDictionary.GetClientDictionaryString("#{79512}"));
|
|
return;
|
|
}
|
|
var AskEnsileTimeLimit = GameManager.gameManager.PlayerDataPool._LastGuildConscribeTime;
|
|
if (AskEnsileTimeLimit > 0 && Time.realtimeSinceStartup - AskEnsileTimeLimit < 300)
|
|
{
|
|
GUIData.AddNotifyData("#{25212}");
|
|
return;
|
|
}
|
|
if (!ChatInputLogic.IsCanChat((int)CG_CHAT.CHATTYPE.CHAT_TYPE_WORLD, true, false))
|
|
return;
|
|
GameManager.gameManager.PlayerDataPool._LastGuildConscribeTime = Time.realtimeSinceStartup;
|
|
Games.ChatHistory.ChatHistoryItem item = new Games.ChatHistory.ChatHistoryItem();
|
|
item.CleanUp();
|
|
item.EChannel = (GC_CHAT.CHATTYPE)((int)CG_CHAT.CHATTYPE.CHAT_TYPE_WORLD);
|
|
string sendStr = StrDictionary.GetClientDictionaryString("#{25236}", GameManager.gameManager.PlayerDataPool.GuildInfo.GuildName, GameManager.gameManager.PlayerDataPool.GuildInfo.GuildGuid);
|
|
item.ChatInfo = sendStr;
|
|
|
|
Utils.SendCGChatPak(item.ChatInfo, item);
|
|
}
|
|
|
|
public void Click_CloseChildWnd()
|
|
{
|
|
if (m_changeZongzhiWnd != null)
|
|
m_changeZongzhiWnd.SetActive(false);
|
|
if (m_changeNameWnd != null)
|
|
m_changeNameWnd.SetActive(false);
|
|
}
|
|
} |