951 lines
31 KiB
C#
951 lines
31 KiB
C#
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using System.Collections;
|
|||
|
using GCGame.Table;
|
|||
|
using GCGame;
|
|||
|
using Module.Log;
|
|||
|
using Games.GlobeDefine;
|
|||
|
using Games.Item;
|
|||
|
using Games.UserCommonData;
|
|||
|
using System.Collections.Generic;
|
|||
|
using Games.LogicObj;
|
|||
|
using Games.Mission;
|
|||
|
using System;
|
|||
|
|
|||
|
public class OptionDialogLogic : UIControllerBase<OptionDialogLogic>
|
|||
|
{
|
|||
|
#region
|
|||
|
|
|||
|
public class OptionInfo
|
|||
|
{
|
|||
|
public string _OptionStr;
|
|||
|
public string _OptionFunc;
|
|||
|
public Hashtable _OptionParams;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
public GameObject _RootPanel;
|
|||
|
public UICameraTexture _CameraTexture; //顶部人物头像
|
|||
|
public Text m_NPCTalk;
|
|||
|
public Text npcName;
|
|||
|
|
|||
|
public UISubScollMenu _SubMenu;
|
|||
|
|
|||
|
private Dictionary<string, OptionInfo> _OptionList = new Dictionary<string, OptionInfo>();
|
|||
|
private Tab_NpcDialog m_NpcDialogInfo;
|
|||
|
private int m_curOptionDialogId;
|
|||
|
private bool m_IsNeedEnterCopyWhenClose = false;
|
|||
|
private bool m_IsHasReq = false;
|
|||
|
private int m_CopySceneId = -1;
|
|||
|
void CleanUp()
|
|||
|
{
|
|||
|
m_NpcDialogInfo = null;
|
|||
|
m_NPCTalk.text = "";
|
|||
|
npcName.text = "";
|
|||
|
m_curOptionDialogId = -1;
|
|||
|
m_IsNeedEnterCopyWhenClose = false;
|
|||
|
m_CopySceneId = -1;
|
|||
|
m_IsHasReq = false;
|
|||
|
}
|
|||
|
void Awake()
|
|||
|
{
|
|||
|
SetInstance(this);
|
|||
|
}
|
|||
|
|
|||
|
private void OnDisable()
|
|||
|
{
|
|||
|
_CameraTexture.DestroyObj();
|
|||
|
}
|
|||
|
|
|||
|
void Start()
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
void FixedUpdate()
|
|||
|
{
|
|||
|
if (Time.frameCount % 15 != 0)
|
|||
|
{
|
|||
|
if (gameObject.activeSelf)
|
|||
|
{
|
|||
|
if (false == Singleton<DialogCore>.GetInstance().IsInDialogArea())
|
|||
|
{
|
|||
|
//UIManager.CloseUI(UIInfo.MissionInfoController);
|
|||
|
OnCloseClick();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void OnDestroy()
|
|||
|
{
|
|||
|
SetInstance(null);
|
|||
|
}
|
|||
|
|
|||
|
void OnEnable()
|
|||
|
{
|
|||
|
_RootPanel.SetActive(false);
|
|||
|
}
|
|||
|
|
|||
|
public void ReqEneterCopyScene()
|
|||
|
{
|
|||
|
CG_REQ_ENTER_COPY req = (CG_REQ_ENTER_COPY)PacketDistributed.CreatePacket(MessageID.PACKET_CG_REQ_ENTER_COPY);
|
|||
|
req.SetCopyid(m_CopySceneId);
|
|||
|
req.SendPacket();
|
|||
|
|
|||
|
m_IsHasReq = true;
|
|||
|
}
|
|||
|
|
|||
|
public void OnCloseClick()
|
|||
|
{
|
|||
|
if(m_IsNeedEnterCopyWhenClose && !m_IsHasReq)
|
|||
|
{
|
|||
|
ReqEneterCopyScene();
|
|||
|
}
|
|||
|
|
|||
|
UIManager.CloseUI(UIInfo.OptionDialogRoot);
|
|||
|
}
|
|||
|
|
|||
|
public static void ShowOptionDialogUI(Obj_NPC _obj)
|
|||
|
{
|
|||
|
UIManager.ShowUI(UIInfo.OptionDialogRoot, OnShowOptionDialog, _obj);
|
|||
|
}
|
|||
|
|
|||
|
public void DoOptionDialog(Obj_NPC _obj, Tab_NpcOptionDialog _tabOption)
|
|||
|
{
|
|||
|
_CameraTexture.gameObject.SetActive(false);
|
|||
|
m_NPCTalk.gameObject.SetActive(false);
|
|||
|
_SubMenu.gameObject.SetActive(false);
|
|||
|
|
|||
|
if (_obj == null)
|
|||
|
return;
|
|||
|
if (_tabOption == null)
|
|||
|
return;
|
|||
|
if (_tabOption.getOptionFuncCount() <= 0)
|
|||
|
return;
|
|||
|
string _OptionStr = _tabOption.GetOptionTextbyIndex(0);
|
|||
|
string _OptionFunc = _tabOption.GetOptionFuncbyIndex(0);
|
|||
|
CleanUp();
|
|||
|
_OptionList.Clear();
|
|||
|
OptionInfo optionInfo = new OptionInfo();
|
|||
|
optionInfo._OptionStr = _OptionStr;
|
|||
|
optionInfo._OptionFunc = _OptionFunc;
|
|||
|
if (optionInfo._OptionParams == null)
|
|||
|
optionInfo._OptionParams = new Hashtable();
|
|||
|
optionInfo._OptionParams.Add("Btnid", _tabOption.GetOptionParambyIndex(0));
|
|||
|
optionInfo._OptionParams.Add("Npc", _obj);
|
|||
|
_OptionList.Add(optionInfo._OptionStr, optionInfo);
|
|||
|
_SelectMenu = _OptionStr;
|
|||
|
Invoke(_OptionFunc, 0);
|
|||
|
}
|
|||
|
|
|||
|
private static int _NpcSoundLimitTime = -1;
|
|||
|
static void PlaySound(int dialogId)
|
|||
|
{
|
|||
|
Debug.LogError("Play Optional Dialog : " + dialogId);
|
|||
|
var DialogLine = TableManager.GetNpcDialogByID(dialogId, 0);
|
|||
|
if (GlobalData.NextNpcSoundTime == -1)
|
|||
|
{
|
|||
|
GameManager.gameManager.SoundManager.StopSoundEffect(GlobalData._PlayingSoundID, 1);
|
|||
|
GlobalData._PlayingSoundID = DialogLine.SoundId;
|
|||
|
GameManager.gameManager.SoundManager.PlaySoundEffect(DialogLine.SoundId, 1);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (GlobalData.ServerAnsiTime > GlobalData.NextNpcSoundTime)
|
|||
|
{
|
|||
|
GameManager.gameManager.SoundManager.StopSoundEffect(GlobalData._PlayingSoundID, 1);
|
|||
|
GlobalData._PlayingSoundID = DialogLine.SoundId;
|
|||
|
GameManager.gameManager.SoundManager.PlaySoundEffect(DialogLine.SoundId, 1);
|
|||
|
|
|||
|
if (_NpcSoundLimitTime == -1)
|
|||
|
{
|
|||
|
_NpcSoundLimitTime = int.Parse(TableManager.GetSystemParamByID(51, 0).StringValue);
|
|||
|
}
|
|||
|
|
|||
|
GlobalData.NextNpcSoundTime += _NpcSoundLimitTime;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
static void OnShowOptionDialog(bool bSuccess, object param)
|
|||
|
{
|
|||
|
if (!bSuccess)
|
|||
|
{
|
|||
|
LogModule.ErrorLog("load OptionDialog fail");
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
Obj_NPC _Obj = (Obj_NPC)param;
|
|||
|
if (_Obj!=null && null != OptionDialogLogic.Instance())
|
|||
|
{
|
|||
|
|
|||
|
//判断点击NPC的操作是否需要出对话框
|
|||
|
Tab_NpcDialog NpcDialogInfo = TableManager.GetNpcDialogByID(_Obj.DefaultDialogID, 0);
|
|||
|
if (NpcDialogInfo != null)
|
|||
|
{
|
|||
|
Tab_NpcOptionDialog _tabOption = TableManager.GetNpcOptionDialogByID(NpcDialogInfo.OptionDialogId, 0);
|
|||
|
if (_tabOption == null)
|
|||
|
return;
|
|||
|
if (_tabOption.IsNeedOpenUI == 1)
|
|||
|
{
|
|||
|
OptionDialogLogic.Instance().DoOptionDialog(_Obj, _tabOption);
|
|||
|
return;
|
|||
|
}else if(_tabOption.IsNeedOpenUI == 3)
|
|||
|
{
|
|||
|
OptionDialogLogic.Instance()._RootPanel.SetActive(true);
|
|||
|
OptionDialogLogic.Instance().DoHideoptionDialogUI(_Obj);
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
OptionDialogLogic.Instance()._RootPanel.SetActive(true);
|
|||
|
OptionDialogLogic.Instance().DoShowOptionDialog(_Obj);
|
|||
|
PlaySound(_Obj.DefaultDialogID);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void ShowOrHideSubMenu(int param)
|
|||
|
{
|
|||
|
_SubMenu.gameObject.SetActive(param != 3);
|
|||
|
}
|
|||
|
|
|||
|
void UpdateNPCInfo()
|
|||
|
{
|
|||
|
Obj_NPC TargetNpc = Singleton<DialogCore>.GetInstance().CareNPC;
|
|||
|
if (TargetNpc != null)
|
|||
|
{
|
|||
|
if (TargetNpc.ModelID >= 0)
|
|||
|
{
|
|||
|
Tab_RoleBaseAttr roleBase = TableManager.GetRoleBaseAttrByID(TargetNpc.BaseAttr.RoleBaseID, 0);
|
|||
|
if (roleBase != null)
|
|||
|
{
|
|||
|
npcName.text = roleBase.Name;
|
|||
|
Tab_CharModel charModel = TableManager.GetCharModelByID(TargetNpc.ModelID, 0);
|
|||
|
if (charModel != null )
|
|||
|
{
|
|||
|
_CameraTexture.InitModelPath(charModel.ResPath, charModel, LoadAssetBundle.BUNDLE_PATH_MODEL,false);
|
|||
|
//LoadAssetBundle.Instance.LoadModelAsync(charModel.ResPath, LoadModelFinish);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
if (m_curOptionDialogId != -1)
|
|||
|
{
|
|||
|
Tab_NpcOptionDialog _npcOptionInfo = TableManager.GetNpcOptionDialogByID(m_curOptionDialogId, 0);
|
|||
|
if (_npcOptionInfo != null)
|
|||
|
{
|
|||
|
m_NPCTalk.text = StrDictionary.GetClientString_WithNameSex(_npcOptionInfo.CenterText);
|
|||
|
}
|
|||
|
|
|||
|
List<OptionInfo> OptionInfos = new List<OptionInfo>();
|
|||
|
for (int i=0;i< m_NpcDialogInfo.getMissionIDCount();i++)
|
|||
|
{
|
|||
|
int missionId = m_NpcDialogInfo.GetMissionIDbyIndex(i);
|
|||
|
//跑环任务特殊处理一下(有OptionDialogId之后会遍历挂载的任务,这样会有两个跑环的Btn,但是不挂入口任务的话就不显示状态,所以这边要屏蔽掉一个入口任务,只显示一个)
|
|||
|
if(missionId == GlobeVar.RINGMISSIONENTERFACEID)
|
|||
|
{
|
|||
|
continue;
|
|||
|
}
|
|||
|
|
|||
|
Tab_MissionBase mission = TableManager.GetMissionBaseByID(missionId, 0);
|
|||
|
if (mission == null)
|
|||
|
continue;
|
|||
|
if (mission.MissionType == (int)MISSIONTYPE.MISSION_MAIN || mission.MissionType == (int)MISSIONTYPE.MISSION_BRANCH)
|
|||
|
{
|
|||
|
if (GameManager.gameManager.MissionManager.CanAcceptMission(missionId) == false)
|
|||
|
continue;
|
|||
|
}
|
|||
|
Games.Mission.MissionState misState = (Games.Mission.MissionState)GameManager.gameManager.MissionManager.GetMissionState(missionId);
|
|||
|
OptionInfo optionInfo = new OptionInfo();
|
|||
|
optionInfo._OptionStr = GetMissionName(missionId); ;
|
|||
|
optionInfo._OptionFunc = "AcceptMission";
|
|||
|
if (optionInfo._OptionParams == null)
|
|||
|
optionInfo._OptionParams = new Hashtable();
|
|||
|
optionInfo._OptionParams.Add("state", (misState == Games.Mission.MissionState.Mission_Completed ? 2 : 1));
|
|||
|
optionInfo._OptionParams.Add("id", mission.Id);
|
|||
|
OptionInfos.Add(optionInfo);
|
|||
|
}
|
|||
|
|
|||
|
OptionInfos.Sort(OptionInfosSort);
|
|||
|
|
|||
|
for (int i=0;i< OptionInfos.Count;i++)
|
|||
|
{
|
|||
|
_OptionList[OptionInfos[i]._OptionStr] = OptionInfos[i];
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public string GetMissionName(int missionId)
|
|||
|
{
|
|||
|
Tab_MissionDictionary missionDic = TableManager.GetMissionDictionaryByID(missionId, 0);
|
|||
|
if(missionDic != null)
|
|||
|
{
|
|||
|
return missionDic.MissionName;
|
|||
|
}else
|
|||
|
{
|
|||
|
return "";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private int OptionInfosSort(OptionInfo info1, OptionInfo info2)
|
|||
|
{
|
|||
|
int state1 = 0;
|
|||
|
int state2 = 0;
|
|||
|
if(info1._OptionParams!=null && info1._OptionParams.ContainsKey("state"))
|
|||
|
{
|
|||
|
state1 = (int)info1._OptionParams["state"];
|
|||
|
}
|
|||
|
|
|||
|
if (info2._OptionParams != null && info2._OptionParams.ContainsKey("state"))
|
|||
|
{
|
|||
|
state2 = (int)info2._OptionParams["state"];
|
|||
|
}
|
|||
|
|
|||
|
int id1 = 0;
|
|||
|
int id2 = 0;
|
|||
|
if (info1._OptionParams != null && info1._OptionParams.ContainsKey("id"))
|
|||
|
{
|
|||
|
id1 = (int)info1._OptionParams["id"];
|
|||
|
}
|
|||
|
|
|||
|
if (info2._OptionParams != null && info2._OptionParams.ContainsKey("id"))
|
|||
|
{
|
|||
|
id2 = (int)info2._OptionParams["id"];
|
|||
|
}
|
|||
|
|
|||
|
if (state1==state2)
|
|||
|
{
|
|||
|
Tab_MissionBase missinfo1 = TableManager.GetMissionBaseByID(id1, 0);
|
|||
|
Tab_MissionBase missinfo2 = TableManager.GetMissionBaseByID(id2, 0);
|
|||
|
if (missinfo1 == null)
|
|||
|
return 0;
|
|||
|
else
|
|||
|
{
|
|||
|
if(missinfo2 != null)
|
|||
|
{
|
|||
|
if(missinfo1.MissionType == missinfo2.MissionType)
|
|||
|
{
|
|||
|
return missinfo1.Id > missinfo2.Id ? 1 : 0;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
return missinfo1.MissionType > missinfo2.MissionType ? 1 : 0;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
return state1 > state2 ? 1 : 0;
|
|||
|
}
|
|||
|
return 1;
|
|||
|
}
|
|||
|
|
|||
|
// 已经失效的接口,并且UICameraTexture.InitShowGO(GameObject showObj)也早以不能使用
|
|||
|
// private void LoadModelFinish(string modelName, GameObject resObj, object param1, object param2, object param3 = null)
|
|||
|
// {
|
|||
|
// if (resObj == null)
|
|||
|
// return;
|
|||
|
//
|
|||
|
// _CameraTexture.InitShowGO(resObj);
|
|||
|
//
|
|||
|
// }
|
|||
|
|
|||
|
//close的时候需要进副本
|
|||
|
void DoHideoptionDialogUI(Obj_NPC _Obj)
|
|||
|
{
|
|||
|
if(_Obj == null)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
_CameraTexture.gameObject.SetActive(true);
|
|||
|
m_NPCTalk.gameObject.SetActive(true);
|
|||
|
_SubMenu.gameObject.SetActive(false);
|
|||
|
CleanUp();
|
|||
|
|
|||
|
m_NpcDialogInfo = TableManager.GetNpcDialogByID(_Obj.DefaultDialogID, 0);
|
|||
|
if (m_NpcDialogInfo != null)
|
|||
|
{
|
|||
|
m_curOptionDialogId = m_NpcDialogInfo.OptionDialogId;
|
|||
|
UpdateNPCInfo();
|
|||
|
var _tabOption = TableManager.GetNpcOptionDialogByID(m_curOptionDialogId, 0);
|
|||
|
if (_tabOption != null)
|
|||
|
{
|
|||
|
m_CopySceneId = int.Parse(_tabOption.GetOptionParambyIndex(0));
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
m_IsNeedEnterCopyWhenClose = true;
|
|||
|
//五秒之后自动进副本
|
|||
|
StartCoroutine(AutoEnterrCopy());
|
|||
|
}
|
|||
|
|
|||
|
void DoShowOptionDialog(Obj_NPC _Obj)
|
|||
|
{
|
|||
|
if (_Obj == null)
|
|||
|
return;
|
|||
|
|
|||
|
_CameraTexture.gameObject.SetActive(true);
|
|||
|
m_NPCTalk.gameObject.SetActive(true);
|
|||
|
_SubMenu.gameObject.SetActive(true);
|
|||
|
CleanUp();
|
|||
|
m_NpcDialogInfo = TableManager.GetNpcDialogByID(_Obj.DefaultDialogID,0);
|
|||
|
if (m_NpcDialogInfo !=null)
|
|||
|
{
|
|||
|
m_curOptionDialogId = m_NpcDialogInfo.OptionDialogId;
|
|||
|
_SubMenu.Clear();
|
|||
|
_OptionList.Clear();
|
|||
|
UpdateButtons(_Obj);
|
|||
|
UpdateNPCInfo();
|
|||
|
foreach (var optionInfo in _OptionList)
|
|||
|
{
|
|||
|
_SubMenu.PushMenu(optionInfo.Value);
|
|||
|
}
|
|||
|
_SubMenu.SetBGRect();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void BtnAutoCompleteCircle()
|
|||
|
{
|
|||
|
ReqAutoCompleteCircleMission req = new ReqAutoCompleteCircleMission();
|
|||
|
req._flag = 1;
|
|||
|
req.SendMsg();
|
|||
|
|
|||
|
UIManager.CloseUI(UIInfo.OptionDialogRoot);
|
|||
|
}
|
|||
|
|
|||
|
private void UpdateButtons(Obj_NPC _Obj)
|
|||
|
{
|
|||
|
|
|||
|
var _tabOption = TableManager.GetNpcOptionDialogByID(m_curOptionDialogId, 0);
|
|||
|
for (int i = _tabOption.getOptionTextCount(); i >= 0; --i)
|
|||
|
{
|
|||
|
if (!string.IsNullOrEmpty(_tabOption.GetOptionTextbyIndex(i)))
|
|||
|
{
|
|||
|
OptionInfo optionInfo = new OptionInfo();
|
|||
|
optionInfo._OptionStr = _tabOption.GetOptionTextbyIndex(i);
|
|||
|
optionInfo._OptionFunc = _tabOption.GetOptionFuncbyIndex(i);
|
|||
|
if (optionInfo._OptionParams == null)
|
|||
|
optionInfo._OptionParams = new Hashtable();
|
|||
|
optionInfo._OptionParams.Add("Btnid", _tabOption.GetOptionParambyIndex(i));
|
|||
|
optionInfo._OptionParams.Add("Npc", _Obj);
|
|||
|
if(optionInfo._OptionFunc.Equals("EnterCopy"))
|
|||
|
{
|
|||
|
optionInfo._OptionParams.Add("needShowEffect", true);
|
|||
|
}
|
|||
|
_OptionList.Add(optionInfo._OptionStr, optionInfo);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private const float _AutoEnterCopyTime = 5.0f;
|
|||
|
IEnumerator AutoEnterrCopy()
|
|||
|
{
|
|||
|
yield return new WaitForSeconds(_AutoEnterCopyTime);
|
|||
|
CG_REQ_ENTER_COPY packet = (CG_REQ_ENTER_COPY)PacketDistributed.CreatePacket(MessageID.PACKET_CG_REQ_ENTER_COPY);
|
|||
|
packet.Copyid = m_CopySceneId;
|
|||
|
|
|||
|
packet.SendPacket();
|
|||
|
UIManager.CloseUI(UIInfo.OptionDialogRoot);
|
|||
|
yield break;
|
|||
|
}
|
|||
|
|
|||
|
public void OnMenuSelect(object optionObj)
|
|||
|
{
|
|||
|
string optionStr = optionObj as string;
|
|||
|
if (_OptionList.ContainsKey(optionStr))
|
|||
|
{
|
|||
|
_SelectMenu = optionStr;
|
|||
|
Invoke(_OptionList[optionStr]._OptionFunc, 0);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#region option func
|
|||
|
|
|||
|
private void PlayWeddingMovie()
|
|||
|
{
|
|||
|
const string movieName = "/Audio/3333.mp4";
|
|||
|
if (MarryMovieCtr.Instance)
|
|||
|
{
|
|||
|
MarryMovieCtr.Instance.PlayMovie(movieName);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
UIManager.ShowUI(UIInfo.MarryMovieCtr, (sucess, param) =>
|
|||
|
{
|
|||
|
MarryMovieCtr.Instance.PlayMovie(movieName);
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
string _SelectMenu = "";
|
|||
|
|
|||
|
void OpenAutoTeam()
|
|||
|
{
|
|||
|
if(GameManager.gameManager.PlayerDataPool.IsHaveTeam())
|
|||
|
{
|
|||
|
UIManager.ShowUI(UIInfo.TeamInfoRoot);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
UIManager.ShowUI(UIInfo.TeamCreateRoot, delegate (bool bSuccess, object param)
|
|||
|
{
|
|||
|
if (bSuccess)
|
|||
|
{
|
|||
|
Hashtable hash = new Hashtable();
|
|||
|
hash["index"] = 1;
|
|||
|
Games.Events.EventDispatcher.Instance.SendMessage(Games.Events.EventId.SELECTTEAMCREATEWNDITEM, hash);
|
|||
|
}
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void OpenShop()
|
|||
|
{
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams == null)
|
|||
|
return;
|
|||
|
if(_OptionList[_SelectMenu]._OptionParams.ContainsKey("Btnid"))
|
|||
|
{
|
|||
|
string param = _OptionList[_SelectMenu]._OptionParams["Btnid"] as string;
|
|||
|
|
|||
|
int shopId = int.Parse(param);
|
|||
|
SysShopController.ShowShop(shopId, true);
|
|||
|
|
|||
|
UIManager.CloseUI(UIInfo.OptionDialogRoot);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void InviteGuildMatch()
|
|||
|
{
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams == null)
|
|||
|
return;
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams.ContainsKey("Npc"))
|
|||
|
{
|
|||
|
Obj_NPC _Obj = _OptionList[_SelectMenu]._OptionParams["Npc"] as Obj_NPC;
|
|||
|
if (_Obj != null)
|
|||
|
{
|
|||
|
if (Singleton<ObjManager>.Instance.MainPlayer != null)
|
|||
|
Singleton<ObjManager>.Instance.MainPlayer.GuildWarUnionInfoReq(CG_GUILD_UNION_MATCH_REQ.UNION_MATCH_REQ.MEMBER_LIST, _Obj.ServerID);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void OpenUI()
|
|||
|
{
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams == null)
|
|||
|
return;
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams.ContainsKey("Btnid"))
|
|||
|
{
|
|||
|
string param = _OptionList[_SelectMenu]._OptionParams["Btnid"] as string;
|
|||
|
|
|||
|
UIManager.ShowUI(UIPathData.m_DicUIName[param], null, null);
|
|||
|
|
|||
|
UIManager.CloseUI(UIInfo.OptionDialogRoot);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void FireWork()
|
|||
|
{
|
|||
|
if (BanQuetOperationPanel.Instance)
|
|||
|
BanQuetOperationPanel.Instance.OnFireWorkBtn();
|
|||
|
UIManager.CloseUI(UIInfo.OptionDialogRoot);
|
|||
|
}
|
|||
|
|
|||
|
//切磋观战
|
|||
|
void DualLookFight()
|
|||
|
{
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams == null)
|
|||
|
return;
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams.ContainsKey("Npc"))
|
|||
|
{
|
|||
|
Obj_NPC _Obj = _OptionList[_SelectMenu]._OptionParams["Npc"] as Obj_NPC;
|
|||
|
if(_Obj != null)
|
|||
|
{
|
|||
|
if(Singleton<ObjManager>.Instance.MainPlayer!=null)
|
|||
|
Singleton<ObjManager>.GetInstance().MainPlayer.ReqDuelOption(CG_COMPETITION_OPTION.COMPETITION_TYPE.SEEWAR, 0, _Obj.ServerID);
|
|||
|
}
|
|||
|
}
|
|||
|
UIManager.CloseUI(UIInfo.OptionDialogRoot);
|
|||
|
}
|
|||
|
|
|||
|
void OpenPopUI()
|
|||
|
{
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams == null)
|
|||
|
return;
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams.ContainsKey("Btnid"))
|
|||
|
{
|
|||
|
string param = _OptionList[_SelectMenu]._OptionParams["Btnid"] as string;
|
|||
|
|
|||
|
Obj_NPC _Obj = null;
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams.ContainsKey("Npc"))
|
|||
|
{
|
|||
|
_Obj = _OptionList[_SelectMenu]._OptionParams["Npc"] as Obj_NPC;
|
|||
|
}
|
|||
|
|
|||
|
UIManager.ShowUI(UIPathData.m_DicUIName[param], delegate(bool bSucess, object _Param) {
|
|||
|
if(bSucess)
|
|||
|
{
|
|||
|
Games.Events.EventDispatcher.Instance.Dispatch(Games.Events.EventId.DialogWithNPC, _Param);
|
|||
|
}
|
|||
|
}, _Obj.BaseAttr.RoleBaseID);
|
|||
|
|
|||
|
UIManager.CloseUI(UIInfo.OptionDialogRoot);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void EnterCopy()
|
|||
|
{
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams == null)
|
|||
|
return;
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams.ContainsKey("Btnid"))
|
|||
|
{
|
|||
|
string param = _OptionList[_SelectMenu]._OptionParams["Btnid"] as string;
|
|||
|
int copyId = int.Parse(param);
|
|||
|
CG_REQ_ENTER_COPY packet = (CG_REQ_ENTER_COPY)PacketDistributed.CreatePacket(MessageID.PACKET_CG_REQ_ENTER_COPY);
|
|||
|
packet.Copyid = copyId;
|
|||
|
|
|||
|
packet.SendPacket();
|
|||
|
UIManager.CloseUI(UIInfo.OptionDialogRoot);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void BackGuild()
|
|||
|
{
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams == null)
|
|||
|
return;
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams.ContainsKey("Btnid"))
|
|||
|
{
|
|||
|
string param = _OptionList[_SelectMenu]._OptionParams["Btnid"] as string;
|
|||
|
if(param=="-1")
|
|||
|
{
|
|||
|
GameManager.gameManager.AutoSearch.BackGuild(GameManager.gameManager.PlayerDataPool.GuildInfo.GuildGuid, -1, 0, 0);
|
|||
|
return;
|
|||
|
}
|
|||
|
int roleId = 0;
|
|||
|
string[] poss = param.Split(',');
|
|||
|
float x = 0;
|
|||
|
float z = 0;
|
|||
|
if (poss.Length > 0)
|
|||
|
int.TryParse(poss[0], out roleId);
|
|||
|
if (poss.Length > 1)
|
|||
|
float.TryParse(poss[1], out x);
|
|||
|
if (poss.Length > 2)
|
|||
|
float.TryParse(poss[2], out z);
|
|||
|
GameManager.gameManager.AutoSearch.BackGuild(GameManager.gameManager.PlayerDataPool.GuildInfo.GuildGuid, roleId, x, z);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void EnterCopyNpcObj()
|
|||
|
{
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams == null)
|
|||
|
return;
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams.ContainsKey("Btnid"))
|
|||
|
{
|
|||
|
string param = _OptionList[_SelectMenu]._OptionParams["Btnid"] as string;
|
|||
|
int copyId = int.Parse(param);
|
|||
|
Obj_NPC _Obj = null;
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams.ContainsKey("Npc"))
|
|||
|
{
|
|||
|
_Obj = _OptionList[_SelectMenu]._OptionParams["Npc"] as Obj_NPC;
|
|||
|
}
|
|||
|
|
|||
|
CG_REQ_ENTER_COPY packet = (CG_REQ_ENTER_COPY)PacketDistributed.CreatePacket(MessageID.PACKET_CG_REQ_ENTER_COPY);
|
|||
|
packet.Copyid = copyId; //
|
|||
|
packet.SetNpcObjId(_Obj.ServerID);
|
|||
|
packet.SendPacket();
|
|||
|
UIManager.CloseUI(UIInfo.OptionDialogRoot);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//帮会联赛召唤BOSS
|
|||
|
void MatchAskBoss()
|
|||
|
{
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams == null)
|
|||
|
return;
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams.ContainsKey("Btnid"))
|
|||
|
{
|
|||
|
string param = _OptionList[_SelectMenu]._OptionParams["Btnid"] as string;
|
|||
|
int indexID = int.Parse(param);
|
|||
|
Obj_NPC _Obj = null;
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams.ContainsKey("Npc"))
|
|||
|
{
|
|||
|
_Obj = _OptionList[_SelectMenu]._OptionParams["Npc"] as Obj_NPC;
|
|||
|
}
|
|||
|
if (_Obj == null)
|
|||
|
return;
|
|||
|
CG_CALL_MONSTER send = (CG_CALL_MONSTER)PacketDistributed.CreatePacket(MessageID.PACKET_CG_CALL_MONSTER);
|
|||
|
send.SetNpcId(_Obj.ServerID);
|
|||
|
send.SetParam(indexID);
|
|||
|
send.SendPacket();
|
|||
|
UIManager.CloseUI(UIInfo.OptionDialogRoot);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//帮会联赛提交矿石
|
|||
|
void MatchGold()
|
|||
|
{
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams == null)
|
|||
|
return;
|
|||
|
Obj_NPC _Obj = null;
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams.ContainsKey("Npc"))
|
|||
|
{
|
|||
|
_Obj = _OptionList[_SelectMenu]._OptionParams["Npc"] as Obj_NPC;
|
|||
|
}
|
|||
|
if (_Obj == null)
|
|||
|
return;
|
|||
|
CG_GUILD_UNION_MATCH_REQ send = (CG_GUILD_UNION_MATCH_REQ)PacketDistributed.CreatePacket(MessageID.PACKET_CG_GUILD_UNION_MATCH_REQ);
|
|||
|
send.SetType((int)CG_GUILD_UNION_MATCH_REQ.UNION_MATCH_REQ.COMMIT_BUFF);
|
|||
|
send.SetParam(_Obj.ServerID);
|
|||
|
send.SendPacket();
|
|||
|
UIManager.CloseUI(UIInfo.OptionDialogRoot);
|
|||
|
}
|
|||
|
|
|||
|
void CallNPCBUFF()
|
|||
|
{
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams == null)
|
|||
|
return;
|
|||
|
int param = -1;
|
|||
|
Obj_NPC _Obj = null;
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams.ContainsKey("Btnid"))
|
|||
|
{
|
|||
|
string paramStr = _OptionList[_SelectMenu]._OptionParams["Btnid"] as string;
|
|||
|
int.TryParse(paramStr, out param);
|
|||
|
}
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams.ContainsKey("Npc"))
|
|||
|
{
|
|||
|
_Obj = _OptionList[_SelectMenu]._OptionParams["Npc"] as Obj_NPC;
|
|||
|
}
|
|||
|
if (_Obj == null)
|
|||
|
return;
|
|||
|
CG_CLICK_BUFF_NPC send = (CG_CLICK_BUFF_NPC)PacketDistributed.CreatePacket(MessageID.PACKET_CG_CLICK_BUFF_NPC);
|
|||
|
send.SetIndex(param);
|
|||
|
send.SetNpcid(_Obj.ServerID);
|
|||
|
send.SendPacket();
|
|||
|
UIManager.CloseUI(UIInfo.OptionDialogRoot);
|
|||
|
}
|
|||
|
|
|||
|
//客户端对完话后关闭
|
|||
|
void SendOptionToServerAndClose()
|
|||
|
{
|
|||
|
SendOptionToServer();
|
|||
|
UIManager.CloseUI(UIInfo.OptionDialogRoot);
|
|||
|
}
|
|||
|
|
|||
|
//客户端对完话后如果服务器需要知道,就通过这条协议发过去
|
|||
|
void SendOptionToServerAndAutoFight()
|
|||
|
{
|
|||
|
SendOptionToServer();
|
|||
|
if(Singleton<ObjManager>.Instance.MainPlayer!=null)
|
|||
|
Singleton<ObjManager>.Instance.MainPlayer.EnterAutoCombat();
|
|||
|
}
|
|||
|
|
|||
|
//客户端对完话后如果服务器需要知道,就通过这条协议发过去
|
|||
|
void SendOptionToServer()
|
|||
|
{
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams == null)
|
|||
|
return;
|
|||
|
int param = -1;
|
|||
|
Obj_NPC _Obj = null;
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams.ContainsKey("Btnid"))
|
|||
|
{
|
|||
|
string paramStr = _OptionList[_SelectMenu]._OptionParams["Btnid"] as string;
|
|||
|
int.TryParse(paramStr, out param);
|
|||
|
}
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams.ContainsKey("Npc"))
|
|||
|
{
|
|||
|
_Obj = _OptionList[_SelectMenu]._OptionParams["Npc"] as Obj_NPC;
|
|||
|
}
|
|||
|
if (_Obj == null || param <= 0)
|
|||
|
return;
|
|||
|
CG_NPC_ADDITION_ACTION send = (CG_NPC_ADDITION_ACTION)PacketDistributed.CreatePacket(MessageID.PACKET_CG_NPC_ADDITION_ACTION);
|
|||
|
send.SetActionType(param);
|
|||
|
send.SetObjId(_Obj.ServerID);
|
|||
|
send.SendPacket();
|
|||
|
//UIManager.CloseUI(UIInfo.OptionDialogRoot);
|
|||
|
}
|
|||
|
|
|||
|
//离开监狱
|
|||
|
void LeaveWanton()
|
|||
|
{
|
|||
|
CG_CHANGE_MAJORCITY send = (CG_CHANGE_MAJORCITY)PacketDistributed.CreatePacket(MessageID.PACKET_CG_CHANGE_MAJORCITY);
|
|||
|
send.SetType(1);
|
|||
|
send.SendPacket();
|
|||
|
}
|
|||
|
|
|||
|
void OpenCangku()
|
|||
|
{
|
|||
|
UIManager.ShowUI(UIInfo.CangKu);
|
|||
|
|
|||
|
UIManager.CloseUI(UIInfo.OptionDialogRoot);
|
|||
|
}
|
|||
|
|
|||
|
void AcceptMission()
|
|||
|
{
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams == null)
|
|||
|
return;
|
|||
|
int id = -1;
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams.ContainsKey("Btnid"))
|
|||
|
{
|
|||
|
string btnID = (string)_OptionList[_SelectMenu]._OptionParams["Btnid"];
|
|||
|
if (int.TryParse(btnID, out id) == false)
|
|||
|
id = -1;
|
|||
|
}
|
|||
|
if(_OptionList[_SelectMenu]._OptionParams.ContainsKey("id"))
|
|||
|
{
|
|||
|
id = (int)_OptionList[_SelectMenu]._OptionParams["id"];
|
|||
|
}
|
|||
|
int result = 0;
|
|||
|
if(id > 0)
|
|||
|
{
|
|||
|
if(GameManager.gameManager.MissionManager.CanAcceptMissionTip(id,true)==0)
|
|||
|
{
|
|||
|
UIManager.CloseUI(UIInfo.OptionDialogRoot);
|
|||
|
MissionInfoController.ShowMissionDialogUI(id);
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
if(result == -9) //需要组队但是没有队伍
|
|||
|
{
|
|||
|
OpenAutoTeam();
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
// 回血NPC对话相关
|
|||
|
void DoRecover()
|
|||
|
{
|
|||
|
Obj_MainPlayer mainPlayer = Singleton<ObjManager>.Instance.MainPlayer;
|
|||
|
if (mainPlayer == null)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
long nCurHP = mainPlayer.BaseAttr.HP;
|
|||
|
long nMaxHp = mainPlayer.BaseAttr.MaxHP;
|
|||
|
int nCurMP = mainPlayer.BaseAttr.MP;
|
|||
|
int nMaxMP = mainPlayer.BaseAttr.MaxMP;
|
|||
|
|
|||
|
if (nCurHP >= nMaxHp && nCurMP >= nMaxMP)
|
|||
|
{
|
|||
|
mainPlayer.SendNoticMsg(false,"#{3291}");
|
|||
|
return;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
long nTempNeedMoney = ((nMaxHp - nCurHP)*7 + (nMaxMP - nCurMP)*77) * 115;
|
|||
|
long nNeedMoney = nTempNeedMoney / 100000 + (nTempNeedMoney > 0 ? 1 : 0);
|
|||
|
if (nNeedMoney < 0)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
string strTip = StrDictionary.GetClientDictionaryString("#{3292}", nNeedMoney);
|
|||
|
MessageBoxLogic.OpenOKCancelBox(strTip, null, OnRecoverOk, OnCloseClick);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void OnRecoverOk()
|
|||
|
{
|
|||
|
Obj_NPC TargetNpc = Singleton<DialogCore>.GetInstance().CareNPC;
|
|||
|
if (TargetNpc == null)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
if (Singleton<ObjManager>.Instance.MainPlayer)
|
|||
|
{
|
|||
|
CG_ASK_RECOVER Pack = (CG_ASK_RECOVER)PacketDistributed.CreatePacket(MessageID.PACKET_CG_ASK_RECOVER);
|
|||
|
Pack.ObjID = TargetNpc.ServerID;
|
|||
|
Pack.SendPacket();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//改名对话相关
|
|||
|
void OnChangeNameForCombineServer()
|
|||
|
{
|
|||
|
if (!Singleton<ObjManager>.GetInstance().MainPlayer)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
if (Singleton<ObjManager>.GetInstance().MainPlayer.IsNameWithCombineServerSign())
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Singleton<ObjManager>.GetInstance().MainPlayer.SendNoticMsg(false, "#{3341}");
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
// 跑商选项相关 1:低级跑商,2:高级跑商
|
|||
|
void DoAcceptPaoShang(int nOptIndex)
|
|||
|
{
|
|||
|
Obj_MainPlayer _mainPlayer = Singleton<ObjManager>.Instance.MainPlayer;
|
|||
|
if (_mainPlayer == null)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
bool bRetMissionPaoshangH = GameManager.gameManager.MissionManager.IsHaveMission(GlobeVar.PAOSHANG_MISSIONID_H);
|
|||
|
bool bRetMissionPaoshangL = GameManager.gameManager.MissionManager.IsHaveMission(GlobeVar.PAOSHANG_MISSIONID_L);
|
|||
|
if (bRetMissionPaoshangH || bRetMissionPaoshangL)
|
|||
|
{
|
|||
|
// 不让接 给个提示吧
|
|||
|
_mainPlayer.SendNoticMsg(false, "#{3926}");
|
|||
|
return;
|
|||
|
}
|
|||
|
// 条件都去服务器检测吧
|
|||
|
CG_ASK_PAOSHANG_ACCEPT Pack = (CG_ASK_PAOSHANG_ACCEPT)PacketDistributed.CreatePacket(MessageID.PACKET_CG_ASK_PAOSHANG_ACCEPT);
|
|||
|
Pack.Type = nOptIndex;
|
|||
|
Pack.SendPacket();
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
void OpenMasterMatch()
|
|||
|
{
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams == null)
|
|||
|
return;
|
|||
|
if (_OptionList[_SelectMenu]._OptionParams.ContainsKey("Btnid"))
|
|||
|
{
|
|||
|
string param = _OptionList[_SelectMenu]._OptionParams["Btnid"] as string;
|
|||
|
|
|||
|
int master = int.Parse(param);
|
|||
|
if (master == 0 || master == 1)
|
|||
|
{
|
|||
|
GameManager.gameManager.PlayerDataPool.m_MasterInfo.SelectMatchInfo(master > 0);
|
|||
|
}
|
|||
|
else if (master == 2)
|
|||
|
{
|
|||
|
if (GameManager.gameManager.PlayerDataPool.m_MasterInfo._MyApprentices.Count > 0)
|
|||
|
{
|
|||
|
MasterInfoLogic.ShowMasterRelieve();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
GUIData.AddNotifyData("#{7218}");
|
|||
|
}
|
|||
|
}
|
|||
|
else if (master == 3)
|
|||
|
{
|
|||
|
if (GameManager.gameManager.PlayerDataPool.m_MasterInfo._MyMaster != null)
|
|||
|
{
|
|||
|
GameManager.gameManager.PlayerDataPool.m_MasterInfo.MasterRelieve(GameManager.gameManager.PlayerDataPool.m_MasterInfo._MyMaster.Guid, GameManager.gameManager.PlayerDataPool.m_MasterInfo._MyMaster.Name);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
GUIData.AddNotifyData("#{7219}");
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//UIManager.CloseUI(UIInfo.OptionDialogRoot);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|