798 lines
30 KiB
C#
798 lines
30 KiB
C#
|
||
using UnityEngine;
|
||
using System.Collections;
|
||
using GCGame;
|
||
using System;
|
||
using Games.GlobeDefine;
|
||
using GCGame.Table;
|
||
using System.Collections.Generic;
|
||
using Module.Log;
|
||
|
||
public class PopMenuLogic : MonoBehaviour {
|
||
|
||
private static PopMenuLogic m_Instance;
|
||
public static PopMenuLogic Instance()
|
||
{
|
||
return m_Instance;
|
||
}
|
||
|
||
public GameObject m_PopMenuOffset; // 菜单位移
|
||
public UIContainerBase _MenuContainer; // 菜单项格子
|
||
private int m_MenuItemsNum; // 菜单项数量
|
||
private UInt64 m_PopMenuSelectGuid; //弹出菜单的目标GUID,菜单弹出时赋值,这样可以在一些通用接口中直接调用
|
||
private int m_PopMenuSelectTeamID;
|
||
private string m_PopMenuSelectName; //弹出菜单的目标姓名,菜单弹出时赋值,这样可以在一些通用接口中直接调用
|
||
private int m_PopMenuSelectProfess;
|
||
private int m_PopMenuSelectLevel;
|
||
public GameObject m_resMenuItem = null;
|
||
|
||
void Awake()
|
||
{
|
||
m_Instance = this;
|
||
m_PopMenuSelectGuid = GlobeVar.INVALID_GUID;
|
||
m_PopMenuSelectName = "";
|
||
}
|
||
// Use this for initialization
|
||
void Start () {
|
||
m_MenuItemsNum = 0;
|
||
}
|
||
|
||
|
||
void OnDestroy()
|
||
{
|
||
m_Instance = null;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 显示菜单
|
||
/// </summary>
|
||
/// <param name="strMenuName">菜单名 主要用于区分不同菜单的定制</param>
|
||
/// <param name="vecPos">菜单位置</param>
|
||
public static void ShowMenu(string strMenuName, GameObject showMenuGO, ulong destGuid = GlobeVar.INVALID_GUID, string destName = "")
|
||
{
|
||
List<object> initParams = new List<object>();
|
||
initParams.Add(strMenuName);
|
||
|
||
initParams.Add(showMenuGO);
|
||
initParams.Add(destGuid);
|
||
initParams.Add(destName);
|
||
|
||
UIManager.ShowUI(UIInfo.PopMenuRoot, PopMenuLogic.ShowUIOver, initParams);
|
||
}
|
||
|
||
static void ShowUIOver(bool bSuccess, object param)
|
||
{
|
||
if (bSuccess)
|
||
{
|
||
List<object> initParams = param as List<object>;
|
||
if (PopMenuLogic.Instance() != null && initParams != null && initParams.Count > 1)
|
||
{
|
||
PopMenuLogic.Instance().ShowPopMenu((string)initParams[0], (GameObject)initParams[1], (ulong)initParams[2], (string)initParams[3]);
|
||
}
|
||
}
|
||
}
|
||
|
||
void ShowPopMenu(string strMenuName, GameObject showMenuGO, ulong destGuid, string destName)
|
||
{
|
||
LogModule.DebugLog("ShowPopMenu:" + strMenuName + "," + destGuid);
|
||
m_PopMenuSelectGuid = destGuid;
|
||
m_PopMenuSelectName = destName;
|
||
//m_PopMenuOffset.transform.localPosition = transform.parent.InverseTransformPoint(destGameObject.transform.position);
|
||
|
||
//List<object> initParams = new List<object>();
|
||
//initParams.Add(strMenuName);
|
||
//initParams.Add(showMenuGO);
|
||
//initParams.Add(destGuid);
|
||
|
||
if (strMenuName == "TargetFramePopMenu")
|
||
{
|
||
ShowTargetFramePopMenu(destGuid);
|
||
}
|
||
else if (strMenuName == "GuildMemberPopMenu")
|
||
{
|
||
ShowGuildMemberPopMenu(destGuid);
|
||
}
|
||
else if (strMenuName == "GuildApplyPopMenu")
|
||
{
|
||
ShowGuildAddNewMemberPopMenu(destGuid);
|
||
}
|
||
else if (strMenuName == "TeamMemberPopMenu")
|
||
{
|
||
ShowTeamPopMenu(showMenuGO, destGuid);
|
||
}
|
||
else if (strMenuName == "PKModePopMenu")
|
||
{
|
||
ShowPKPopMenu(showMenuGO, destGuid);
|
||
}
|
||
else if (strMenuName == "RankAddGuild") //排行榜中的申请入帮
|
||
{
|
||
ShowRankGuildMenu(showMenuGO, destGuid);
|
||
}
|
||
else if (strMenuName == "ShowCaptainInfo") //排行榜中的申请入帮
|
||
{
|
||
ShowTeamNearbyCaptainInfo(destGuid);
|
||
}
|
||
|
||
//UIManager.LoadItem(UIInfo.PopMenuItem, LoadItemOver, initParams);
|
||
}
|
||
|
||
void LoadItemOver(GameObject resObj, object param)
|
||
{
|
||
if (resObj == null)
|
||
{
|
||
return;
|
||
}
|
||
|
||
m_resMenuItem = resObj;
|
||
|
||
List<object> initParams = param as List<object>;
|
||
if (initParams == null)
|
||
{
|
||
return;
|
||
}
|
||
|
||
string strMenuName = (string)initParams[0];
|
||
GameObject showGO = (GameObject)initParams[1];
|
||
ulong destGuid = (ulong)initParams[2];
|
||
|
||
|
||
|
||
}
|
||
|
||
|
||
|
||
//////////////////////////////////////////////////////////////////////////
|
||
//PopMenu下的一些通用方法,只要在弹出PopMenu的时候记录了弹出目标的Guid与Name即可
|
||
//////////////////////////////////////////////////////////////////////////
|
||
//加好友
|
||
void PopMenuAddFriend()
|
||
{
|
||
//如果非玩家,则不显示
|
||
if (GlobeVar.INVALID_GUID == m_PopMenuSelectGuid)
|
||
{
|
||
return;
|
||
}
|
||
|
||
Singleton<ObjManager>.Instance.MainPlayer.ReqAddFriend(m_PopMenuSelectGuid);
|
||
}
|
||
|
||
//私聊
|
||
void PopMenuChat()
|
||
{
|
||
//如果非玩家,则无效
|
||
if (GlobeVar.INVALID_GUID == m_PopMenuSelectGuid)
|
||
{
|
||
return;
|
||
}
|
||
|
||
//如果目标是自己
|
||
if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Guid == m_PopMenuSelectGuid)
|
||
{
|
||
return;
|
||
}
|
||
|
||
LogModule.DebugLog("Chat name:" + m_PopMenuSelectName);
|
||
//未打开过则创建
|
||
FriendAndMailRoot.ShowFriendChat(m_PopMenuSelectGuid, m_PopMenuSelectName);
|
||
}
|
||
|
||
void OnJoinTeam()
|
||
{
|
||
|
||
if (null == Singleton<ObjManager>.GetInstance().MainPlayer)
|
||
{
|
||
return;
|
||
}
|
||
|
||
//如果目标是自己也不发送加好友
|
||
if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Guid == m_PopMenuSelectGuid)
|
||
{
|
||
return;
|
||
}
|
||
|
||
Singleton<ObjManager>.GetInstance().MainPlayer.ReqJoinTeam(m_PopMenuSelectTeamID);
|
||
}
|
||
|
||
//邀请入队
|
||
void PopMenuInviteTeam()
|
||
{
|
||
//如果非玩家,则无效
|
||
if (GlobeVar.INVALID_GUID == m_PopMenuSelectGuid)
|
||
{
|
||
return;
|
||
}
|
||
|
||
//如果目标是自己也不发送加好友
|
||
if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Guid == m_PopMenuSelectGuid)
|
||
{
|
||
return;
|
||
}
|
||
|
||
if (null == Singleton<ObjManager>.GetInstance().MainPlayer)
|
||
{
|
||
return;
|
||
}
|
||
|
||
//如果有队伍,则判断下队伍是否已满
|
||
if (GlobeVar.INVALID_ID != GameManager.gameManager.PlayerDataPool.TeamInfo.TeamID)
|
||
{
|
||
if (GameManager.gameManager.PlayerDataPool.TeamInfo.IsFull())
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
|
||
Singleton<ObjManager>.GetInstance().MainPlayer.ReqInviteTeam(m_PopMenuSelectGuid);
|
||
}
|
||
|
||
//提升队长
|
||
void PopMenuLeader()
|
||
{
|
||
//如果非玩家,则无效
|
||
if (GlobeVar.INVALID_GUID == m_PopMenuSelectGuid)
|
||
{
|
||
return;
|
||
}
|
||
|
||
//如果目标是自己
|
||
if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Guid == m_PopMenuSelectGuid)
|
||
{
|
||
return;
|
||
}
|
||
|
||
if (null == Singleton<ObjManager>.GetInstance().MainPlayer)
|
||
{
|
||
return;
|
||
}
|
||
|
||
//如果有队伍
|
||
if (GlobeVar.INVALID_ID != GameManager.gameManager.PlayerDataPool.TeamInfo.TeamID)
|
||
{
|
||
//如果自己不是队长,则返回
|
||
if (false == Singleton<ObjManager>.GetInstance().MainPlayer.IsTeamLeader())
|
||
{
|
||
return;
|
||
}
|
||
|
||
//guid检测
|
||
if (GlobeVar.INVALID_GUID == m_PopMenuSelectGuid)
|
||
{
|
||
return;
|
||
}
|
||
|
||
Singleton<ObjManager>.GetInstance().MainPlayer.ReqChangeTeamLeader(m_PopMenuSelectGuid);
|
||
}
|
||
}
|
||
|
||
//踢出队伍
|
||
void PopMenuKick()
|
||
{
|
||
//如果非玩家,则无效
|
||
if (GlobeVar.INVALID_GUID == m_PopMenuSelectGuid)
|
||
{
|
||
return;
|
||
}
|
||
|
||
//如果目标是自己
|
||
if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Guid == m_PopMenuSelectGuid)
|
||
{
|
||
return;
|
||
}
|
||
|
||
if (null == Singleton<ObjManager>.GetInstance().MainPlayer)
|
||
{
|
||
return;
|
||
}
|
||
|
||
//如果有队伍
|
||
if (GlobeVar.INVALID_ID != GameManager.gameManager.PlayerDataPool.TeamInfo.TeamID)
|
||
{
|
||
//如果自己不是队长,则返回
|
||
if (false == Singleton<ObjManager>.GetInstance().MainPlayer.IsTeamLeader())
|
||
{
|
||
return;
|
||
}
|
||
|
||
//guid检测
|
||
if (GlobeVar.INVALID_GUID == m_PopMenuSelectGuid)
|
||
{
|
||
return;
|
||
}
|
||
|
||
//发送踢人消息
|
||
Singleton<ObjManager>.GetInstance().MainPlayer.ReqKickTeamMember(m_PopMenuSelectGuid);
|
||
}
|
||
}
|
||
|
||
//申请队长
|
||
void PopApplyLeader()
|
||
{
|
||
if (null == Singleton<ObjManager>.GetInstance().MainPlayer)
|
||
{
|
||
return;
|
||
}
|
||
|
||
CG_REQ_BECOME_TEAM_LEADER packet = (CG_REQ_BECOME_TEAM_LEADER)PacketDistributed.CreatePacket(MessageID.PACKET_CG_REQ_BECOME_TEAM_LEADER);
|
||
packet.Nilparam = 1;
|
||
packet.SendPacket();
|
||
}
|
||
|
||
//切磋
|
||
void PopMenuDuel()
|
||
{
|
||
//如果非玩家,则无效
|
||
if (GlobeVar.INVALID_GUID == m_PopMenuSelectGuid)
|
||
{
|
||
return;
|
||
}
|
||
//如果目标是自己也不发送
|
||
if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Guid == m_PopMenuSelectGuid)
|
||
{
|
||
return;
|
||
}
|
||
|
||
if (null == Singleton<ObjManager>.GetInstance().MainPlayer)
|
||
{
|
||
return;
|
||
}
|
||
|
||
Singleton<ObjManager>.GetInstance().MainPlayer.ReqDuelOption(CG_COMPETITION_OPTION.COMPETITION_TYPE.INVITE, m_PopMenuSelectGuid,0);
|
||
}
|
||
|
||
//查看属性
|
||
void PopMenuView()
|
||
{
|
||
//如果非玩家,则无效
|
||
if (GlobeVar.INVALID_GUID == m_PopMenuSelectGuid)
|
||
{
|
||
return;
|
||
}
|
||
if (null == Singleton<ObjManager>.GetInstance().MainPlayer)
|
||
{
|
||
return;
|
||
}
|
||
|
||
//如果目标是自己也不发送
|
||
if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Guid == m_PopMenuSelectGuid)
|
||
{
|
||
return;
|
||
}
|
||
|
||
Singleton<ObjManager>.GetInstance().MainPlayer.ReqViewOtherPlayer(m_PopMenuSelectGuid, OtherRoleViewLogic.OPEN_TYPE.OPEN_TYPE_POPMENU);
|
||
}
|
||
//查看寄售行信息
|
||
void PopMenuConsignSaleInfo()
|
||
{
|
||
//UIManager.ShowUI(UIInfo.ConsignSaleRoot, BuyItemOpenConsignSale);
|
||
}
|
||
|
||
//邀请入帮
|
||
void PopMenuInviteGuild()
|
||
{
|
||
if (null == Singleton<ObjManager>.GetInstance().MainPlayer)
|
||
{
|
||
return;
|
||
}
|
||
|
||
if (GlobeVar.INVALID_GUID == GameManager.gameManager.PlayerDataPool.GuildInfo.GuildGuid)
|
||
{
|
||
//你当前未加入帮会,无法邀请。
|
||
Singleton<ObjManager>.GetInstance().MainPlayer.SendNoticMsg(false, "#{2686}");
|
||
return;
|
||
}
|
||
|
||
Singleton<ObjManager>.GetInstance().MainPlayer.ReqInviteGuild(m_PopMenuSelectGuid);
|
||
}
|
||
|
||
//申请加帮派
|
||
void PopMeunJoinGuild()
|
||
{
|
||
//如果非玩家,则则无效
|
||
if (GlobeVar.INVALID_GUID == m_PopMenuSelectGuid)
|
||
{
|
||
return;
|
||
}
|
||
|
||
if (null == Singleton<ObjManager>.GetInstance().MainPlayer)
|
||
{
|
||
return;
|
||
}
|
||
|
||
//如果目标是自己也不发送加帮派
|
||
if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Guid == m_PopMenuSelectGuid)
|
||
{
|
||
return;
|
||
}
|
||
|
||
if (GameManager.gameManager.PlayerDataPool.GuildInfo.GuildGuid != GlobeVar.INVALID_GUID)
|
||
{
|
||
if (GameManager.gameManager.PlayerDataPool.GuildInfo.GuildJob == (int)GameDefine_Globe.GUILD_JOB.RESERVE)
|
||
{
|
||
//只能同时申请一个帮会,将替换原来的请求,是否继续?
|
||
string dicStr = StrDictionary.GetClientDictionaryString("#{1861}");
|
||
MessageBoxLogic.OpenOKCancelBox(dicStr, "", AgreeChangeJoinGuildRequest, null);
|
||
return;
|
||
}
|
||
//你当前已经有帮会,无法申请。
|
||
Singleton<ObjManager>.GetInstance().MainPlayer.SendNoticMsg(false, "#{3094}");
|
||
return;
|
||
}
|
||
|
||
Singleton<ObjManager>.GetInstance().MainPlayer.ReqJoinOtherPlayerGuild(m_PopMenuSelectGuid, m_PopMenuSelectName);
|
||
}
|
||
|
||
void AgreeChangeJoinGuildRequest()
|
||
{
|
||
if (Singleton<ObjManager>.GetInstance().MainPlayer != null)
|
||
{
|
||
Singleton<ObjManager>.GetInstance().MainPlayer.ReqJoinOtherPlayerGuild(m_PopMenuSelectGuid, m_PopMenuSelectName);
|
||
}
|
||
}
|
||
|
||
void BuyItemOpenConsignSale(bool bSuccess, object param)
|
||
{
|
||
if (bSuccess)
|
||
{
|
||
//if (ConsignSaleLogic.Instance() != null)
|
||
//{
|
||
// ConsignSaleLogic.Instance().SearchForAskBuy(m_PopMenuSelectName);
|
||
//}
|
||
}
|
||
}
|
||
|
||
void PKModeNormal()
|
||
{
|
||
PlayerFrameLogic.Instance().SendNewPKModle((int)CharacterDefine.PKMODLE.NORMAL);
|
||
}
|
||
void PKModeEvil()
|
||
{
|
||
PlayerFrameLogic.Instance().SendNewPKModle((int)CharacterDefine.PKMODLE.Evil);
|
||
}
|
||
void PKModeCamp()
|
||
{
|
||
PlayerFrameLogic.Instance().SendNewPKModle((int)CharacterDefine.PKMODLE.Camp);
|
||
}
|
||
void PKModeKill()
|
||
{
|
||
PlayerFrameLogic.Instance().OnKillModleClick();
|
||
}
|
||
|
||
void PKModeDesc()
|
||
{
|
||
PlayerFrameLogic.Instance().ShowPKDesc();
|
||
}
|
||
|
||
void ShowTeamNearbyCaptainInfo(ulong guid)
|
||
{
|
||
m_PopMenuSelectGuid = guid;
|
||
List<PopMenuItemLogic.InitMenuInfo> menuInfoList = new List<PopMenuItemLogic.InitMenuInfo>();
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1299}"), PopMenuAddFriend)); //加好友
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1300}"), OnSendMessage)); //私聊
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1766}"), PopMenuView)); //查看信息
|
||
|
||
_MenuContainer.InitContentItem(menuInfoList);
|
||
}
|
||
|
||
//////////////////////////////////////////////////////////////////////////
|
||
//目标头像PopMenu点击相关函数以及其专属菜单项函数
|
||
//////////////////////////////////////////////////////////////////////////
|
||
void ShowTargetFramePopMenu(ulong destGuid)
|
||
{
|
||
//如果非玩家,则无效
|
||
// if (null == TargetFrameLogic.Instance() || GlobeVar.INVALID_GUID == TargetFrameLogic.Instance().TargetGuid)
|
||
// {
|
||
// return;
|
||
// }
|
||
|
||
//如果目标是自己也不发送加好友
|
||
if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Guid == destGuid)
|
||
{
|
||
return;
|
||
}
|
||
|
||
m_PopMenuSelectGuid = destGuid;
|
||
m_PopMenuSelectName = TargetFrameLogic.Instance().StrTargetName;
|
||
|
||
List<PopMenuItemLogic.InitMenuInfo> menuInfoList = new List<PopMenuItemLogic.InitMenuInfo>();
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1299}"), PopMenuAddFriend));
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1300}"), PopMenuChat)); //私聊
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1301}"), PopMenuInviteTeam)); //邀请入队
|
||
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1657}"), PopMenuDuel)); //申请切磋
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{2181}"), PopMenuView)); //申请查看信息
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{2554}"), PopMenuConsignSaleInfo));//申请查看寄售信息
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1156}"), PopMenuInviteGuild)); //邀请入帮
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{3093}"), PopMeunJoinGuild)); //申请入帮
|
||
|
||
_MenuContainer.InitContentItem(menuInfoList);
|
||
}
|
||
|
||
//////////////////////////////////////////////////////////////////////////
|
||
//目标头像PopMenu点击相关函数以及其专属菜单项函数
|
||
//////////////////////////////////////////////////////////////////////////
|
||
void ShowTeamPopMenu(GameObject showGO, ulong destGuid)
|
||
{
|
||
//如果非玩家,则无效
|
||
if (GlobeVar.INVALID_GUID == destGuid)
|
||
{
|
||
ClosePopMenu();
|
||
return;
|
||
}
|
||
|
||
//如果目标是自己也不发送加好友
|
||
if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Guid == destGuid)
|
||
{
|
||
ClosePopMenu();
|
||
return;
|
||
}
|
||
|
||
var position = showGO.transform.position;
|
||
if (position.x < 0)
|
||
{
|
||
m_PopMenuOffset.transform.position = position + new Vector3(2.1f, 2.431f);
|
||
}
|
||
else
|
||
{
|
||
m_PopMenuOffset.transform.position = position + new Vector3(-1.35f, 2.431f);
|
||
}
|
||
|
||
LogModule.DebugLog("showPopPos:" + position);
|
||
|
||
m_PopMenuSelectGuid = destGuid;
|
||
//m_PopMenuSelectName = TargetFrameLogic.Instance().StrTargetName;
|
||
|
||
List<PopMenuItemLogic.InitMenuInfo> menuInfoList = new List<PopMenuItemLogic.InitMenuInfo>();
|
||
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1300}"), PopMenuChat)); //私聊
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{2181}"), PopMenuView)); //申请查看信息
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1299}"), PopMenuAddFriend)); //加好友
|
||
|
||
if (Singleton<ObjManager>.GetInstance().MainPlayer.IsTeamLeader())
|
||
{
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1164}"), PopMenuLeader)); //任命队长
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1163}"), PopMenuKick)); //请离队伍
|
||
}
|
||
else
|
||
{
|
||
if (GameManager.gameManager.PlayerDataPool.TeamInfo.GetTeamMember(0).Guid == m_PopMenuSelectGuid)
|
||
{
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{5152}"), PopApplyLeader)); //申请队长
|
||
}
|
||
}
|
||
|
||
|
||
_MenuContainer.InitContentItem(menuInfoList);
|
||
}
|
||
|
||
//////////////////////////////////////////////////////////////////////////
|
||
//目标头像PopMenu点击相关函数以及其专属菜单项函数
|
||
//////////////////////////////////////////////////////////////////////////
|
||
void ShowPKPopMenu(GameObject showGO, ulong destGuid)
|
||
{
|
||
var position = showGO.transform.position;
|
||
if (position.x < 0)
|
||
{
|
||
m_PopMenuOffset.transform.position = position + new Vector3(2.834f, 0f);
|
||
}
|
||
else
|
||
{
|
||
m_PopMenuOffset.transform.position = position + new Vector3(-2.834f, 0f);
|
||
}
|
||
|
||
LogModule.DebugLog("showPopPos:" + position);
|
||
|
||
m_PopMenuSelectGuid = destGuid;
|
||
//m_PopMenuSelectName = TargetFrameLogic.Instance().StrTargetName;
|
||
|
||
List<PopMenuItemLogic.InitMenuInfo> menuInfoList = new List<PopMenuItemLogic.InitMenuInfo>();
|
||
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{4707}"), PKModeNormal)); //和平模式
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{35005}"), PKModeEvil)); //善恶模式
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{35006}"), PKModeCamp)); //阵营模式
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{35007}"), PKModeKill)); //全体模式
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{4709}"), PKModeDesc)); //PK说明
|
||
|
||
_MenuContainer.InitContentItem(menuInfoList);
|
||
}
|
||
|
||
void ShowRankGuildMenu(GameObject showGO, ulong destGuid)
|
||
{
|
||
var position = showGO.transform.position;
|
||
if (position.x < 0)
|
||
{
|
||
m_PopMenuOffset.transform.position = position + new Vector3(2.834f, 0f);
|
||
}
|
||
else
|
||
{
|
||
m_PopMenuOffset.transform.position = position + new Vector3(-2.834f, 0f);
|
||
}
|
||
|
||
m_PopMenuSelectGuid = destGuid;
|
||
|
||
List<PopMenuItemLogic.InitMenuInfo> menuInfoList = new List<PopMenuItemLogic.InitMenuInfo>();
|
||
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{3093}"), PopMeunJoinGuild)); //申请入帮
|
||
|
||
_MenuContainer.InitContentItem(menuInfoList);
|
||
}
|
||
|
||
void ShowGuildAddNewMemberPopMenu(ulong guid)
|
||
{
|
||
m_PopMenuSelectGuid = guid;
|
||
List<PopMenuItemLogic.InitMenuInfo> menuInfoList = new List<PopMenuItemLogic.InitMenuInfo>();
|
||
if(m_PopMenuSelectName.Length>0)
|
||
{
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1300}"), PopMenuChat)); //私聊
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{2181}"), PopMenuView)); //申请查看信息
|
||
}
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1860}"), GuildMemberDisagreeReserve)); //拒绝
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1859}"), GuildMemberAgreeReserve)); //同意
|
||
_MenuContainer.InitContentItem(menuInfoList);
|
||
}
|
||
|
||
//////////////////////////////////////////////////////////////////////////
|
||
//帮会会员PopMenu以及其专属菜单项函数
|
||
//////////////////////////////////////////////////////////////////////////
|
||
void ShowGuildMemberPopMenu(ulong guid)
|
||
{
|
||
////在帮会数据中找到本人
|
||
GuildMember mySelfGuildInfo;
|
||
GuildMember MemberGuildfInfo;
|
||
if (GameManager.gameManager.PlayerDataPool.GuildInfo.GuildMemberList.TryGetValue(GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Guid, out mySelfGuildInfo))
|
||
{
|
||
if (!mySelfGuildInfo.IsValid())
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
|
||
if (GameManager.gameManager.PlayerDataPool.GuildInfo.GuildMemberList.TryGetValue(guid, out MemberGuildfInfo))
|
||
{
|
||
if (!MemberGuildfInfo.IsValid())
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
|
||
////如果本人为预备役会员,不弹出popmenu
|
||
//if (mySelfGuildInfo.Job == (int)GameDefine_Globe.GUILD_JOB.RESERVE)
|
||
//{
|
||
// return;
|
||
//}
|
||
|
||
List<PopMenuItemLogic.InitMenuInfo> menuInfoList = new List<PopMenuItemLogic.InitMenuInfo>();
|
||
|
||
////根据自己和member的信息,获得不同的菜单项
|
||
if (mySelfGuildInfo.Job == (int)GameDefine_Globe.GUILD_JOB.PRERESERVE)
|
||
{
|
||
if (mySelfGuildInfo.Job != (int)GameDefine_Globe.GUILD_JOB.MEMBER)
|
||
{
|
||
//预备役会员打开审批通过按钮
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1860}"), GuildMemberDisagreeReserve)); //拒绝
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1859}"), GuildMemberAgreeReserve)); //同意
|
||
}
|
||
}
|
||
else
|
||
{
|
||
//这种情况下由于popMenu过长,所以固定位置
|
||
m_PopMenuOffset.transform.localPosition = new UnityEngine.Vector3(0, 120, 0);
|
||
|
||
//只有帮主可以看到的选项
|
||
if (mySelfGuildInfo.Job == (int)GameDefine_Globe.GUILD_JOB.CHIEF)
|
||
{
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{2978}"), GuildMemberCommission));
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1769}"), GuildMemberChangeToMaster)); //禅让
|
||
|
||
//默认选项
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1299}"), PopMenuAddFriend)); //加好友
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1300}"), OnSendMessage)); //私聊
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1766}"), PopMenuView)); //查看信息
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1301}"), PopMenuInviteTeam)); //邀请入队
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1302}"), OnJoinTeam)); //申请入队
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1770}"), GuildMemberExpel)); //逐出
|
||
}
|
||
//只有副帮主可以看到的选项
|
||
else if (mySelfGuildInfo.Job == (int)GameDefine_Globe.GUILD_JOB.VICE_CHIEF)
|
||
{
|
||
|
||
//默认选项
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1299}"), PopMenuAddFriend)); //加好友
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1300}"), OnSendMessage)); //私聊
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1766}"), PopMenuView)); //查看信息
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1301}"), PopMenuInviteTeam)); //邀请入队
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1302}"), OnJoinTeam)); //申请入队
|
||
if (MemberGuildfInfo.Job != (int)GameDefine_Globe.GUILD_JOB.CHIEF)
|
||
{
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1770}"), GuildMemberExpel)); //逐出
|
||
}
|
||
}
|
||
else
|
||
{
|
||
//默认选项
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1299}"), PopMenuAddFriend)); //加好友
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1300}"), PopMenuChat)); //私聊
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1766}"), PopMenuView)); //查看信息
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1301}"), PopMenuInviteTeam)); //邀请入队
|
||
menuInfoList.Add(new PopMenuItemLogic.InitMenuInfo(StrDictionary.GetClientDictionaryString("#{1302}"), OnJoinTeam)); //申请入队
|
||
}
|
||
m_PopMenuSelectProfess = MemberGuildfInfo.Profession;
|
||
m_PopMenuSelectLevel = MemberGuildfInfo.Level;
|
||
}
|
||
_MenuContainer.InitContentItem(menuInfoList);
|
||
}
|
||
|
||
//预备役会员审批通过
|
||
void GuildMemberAgreeReserve()
|
||
{
|
||
Singleton<ObjManager>.GetInstance().MainPlayer.ReqApproveGuildMember(m_PopMenuSelectGuid, 1);
|
||
}
|
||
|
||
//预备役会员审批未通过
|
||
void GuildMemberDisagreeReserve()
|
||
{
|
||
Singleton<ObjManager>.GetInstance().MainPlayer.ReqApproveGuildMember(m_PopMenuSelectGuid, 0);
|
||
}
|
||
|
||
void OnSendMessage()
|
||
{
|
||
//如果非玩家,则无效
|
||
if (GlobeVar.INVALID_GUID == m_PopMenuSelectGuid)
|
||
{
|
||
return;
|
||
}
|
||
|
||
//如果目标是自己
|
||
if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Guid == m_PopMenuSelectGuid)
|
||
{
|
||
return;
|
||
}
|
||
|
||
GameManager.gameManager.PlayerDataPool.ChatHistory.AddFriendChat(m_PopMenuSelectGuid, m_PopMenuSelectName, Utils.GetProfessionSpriteName(m_PopMenuSelectProfess), m_PopMenuSelectLevel, m_PopMenuSelectGuid, 0, 0, null);
|
||
//未打开过则创建
|
||
FriendAndMailRoot.ShowFriendChat(m_PopMenuSelectGuid, m_PopMenuSelectName);
|
||
}
|
||
|
||
//任命
|
||
void GuildMemberCommission()
|
||
{
|
||
|
||
Games.Events.EventDispatcher.Instance.Dispatch(Games.Events.EventId.OpenSetNewJob);
|
||
|
||
// if (null != Singleton<ObjManager>.GetInstance().MainPlayer)
|
||
// {
|
||
// Singleton<ObjManager>.GetInstance().MainPlayer.ReqCommisionGuildMember(m_PopMenuSelectGuid);
|
||
// }
|
||
}
|
||
|
||
//禅让
|
||
void GuildMemberChangeToMaster()
|
||
{
|
||
if (null != Singleton<ObjManager>.GetInstance().MainPlayer)
|
||
{
|
||
Singleton<ObjManager>.GetInstance().MainPlayer.ReqChangeGuildMaster(m_PopMenuSelectGuid);
|
||
}
|
||
}
|
||
|
||
//逐出
|
||
void GuildMemberExpel()
|
||
{
|
||
if (null != Singleton<ObjManager>.GetInstance().MainPlayer)
|
||
{
|
||
Singleton<ObjManager>.GetInstance().MainPlayer.ReqKickGuildMember(m_PopMenuSelectGuid);
|
||
}
|
||
}
|
||
|
||
public void ClosePopMenu()
|
||
{
|
||
UIManager.CloseUI(UIInfo.PopMenuRoot);
|
||
}
|
||
}
|