/// <summary> /// 根据货币类型获取当前拥有数量 /// </summary> /// <param name="mType"></param> /// <returns></returns> public int GetCurrencyNumByType(GameCmd.MoneyType mType) { int num = 0; Client.IPlayer player = MainPlayer; if (null != player) { switch (mType) { case GameCmd.MoneyType.MoneyType_Gold: num = player.GetProp((int)Client.PlayerProp.Coupon); break; case GameCmd.MoneyType.MoneyType_Coin: num = player.GetProp((int)Client.PlayerProp.Cold); break; case GameCmd.MoneyType.MoneyType_MoneyTicket: num = player.GetProp((int)Client.PlayerProp.Money); break; case GameCmd.MoneyType.MoneyType_Reputation: num = player.GetProp((int)Client.PlayerProp.Reputation); break; case GameCmd.MoneyType.MoneyType_Score: num = player.GetProp((int)Client.PlayerProp.Score); break; } } return(num); }
private void OnUIGridEventDlg(UIEventType eventType, object data, object param) { if (null == data) { return; } switch (eventType) { case UIEventType.Click: { if (data is ChangeLineGrid) { ChangeLineGrid item = data as ChangeLineGrid; if (item != null) { Client.IPlayer mainPlayer = MainPlayerHelper.GetMainPlayer(); if (mainPlayer != null) { mainPlayer.SendMessage(Client.EntityMessage.EntityCommand_StopMove, mainPlayer.GetPos()); } stSwitchLineMapScreenUserCmd_C cmd = new stSwitchLineMapScreenUserCmd_C(); cmd.line = item.LineNum; NetService.Instance.Send(cmd); } if (m_ctor_LineScrollView != null) { m_ctor_LineScrollView.SetSelect(item); } } } break; } }
/// <summary> /// 服务器返回订单信息 /// </summary> public void OnRequestRechargeOrder(GameCmd.stCreatePlatOrderPropertyUserCmd_S msg) { Client.IPlayer mainPlayer = DataManager.Instance.MainPlayer; if (null == mainPlayer) { return; } uint characterID = mainPlayer.GetID(); int characterLv = mainPlayer.GetProp((int)Client.CreatureProp.Level); ClanDefine.LocalClanInfo clanInfo = DataManager.Manager <ClanManger>().ClanInfo; string clanName = ""; if (null != clanInfo) { clanName = clanInfo.Name; } Pmd.ZoneInfo zoneInfo = DataManager.Manager <LoginDataManager>().GetZoneInfo(); string currencyName = "元宝"; string roleName = mainPlayer.GetName(); table.RechargeDataBase rechargeDb = GameTableManager.Instance.GetTableItem <table.RechargeDataBase>(msg.goodid); //平台支付 DoPlatformPay(msg, characterID, characterLv, roleName, clanName, zoneInfo, currencyName, CURRENCY_RATIO, rechargeDb); }
private void ApplyMaterial(Client.IPlayer pPlayer, uint uSuit) { table.SuitDataBase data = GameTableManager.Instance.GetTableItem <table.SuitDataBase>(uSuit); if (data == null) { return; } if (data.defaultMaterial == 0) { return; } table.ResourceDataBase res = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(data.defaultMaterial); if (res == null) { return; } if (res.strPath == "") { return; } Engine.IRenderObj renderObj = pPlayer.renderObj; if (renderObj != null) { renderObj.ApplyMaterial(res.strPath); } }
/// <summary> /// 刷新剩余钱币爽 /// </summary> private void UpdateCurrencyLeft() { GameCmd.CommonStore activeStore = DataManager.Manager <MallManager>().BlackMarketActiveStore; bool visible = (activeStore == GameCmd.CommonStore.CommonStore_HundredThree)? false : true; if (null != m_trans_LeftCurrencyContent && m_trans_LeftCurrencyContent.gameObject.activeSelf != visible) { m_trans_LeftCurrencyContent.gameObject.SetActive(visible); } if (!visible) { return; } Client.IPlayer player = DataManager.Instance.MainPlayer; if (null == player) { return; } uint num = 0; string iconName = ""; switch (activeStore) { case GameCmd.CommonStore.CommonStore_HundredOne: iconName = MallDefine.GetCurrencyIconNameByType(GameCmd.MoneyType.MoneyType_Reputation); num = (uint)player.GetProp((int)Client.PlayerProp.Reputation); break; case GameCmd.CommonStore.CommonStore_HundredTwo: iconName = MallDefine.GetCurrencyIconNameByType(GameCmd.MoneyType.MoneyType_Score); num = (uint)player.GetProp((int)Client.PlayerProp.Score); break; case GameCmd.CommonStore.CommonStore_HundredFour: iconName = MallDefine.GetCurrencyIconNameByType(GameCmd.MoneyType.MoneyType_CampCoin); num = (uint)player.GetProp((int)Client.PlayerProp.CampCoin); break; case GameCmd.CommonStore.CommonStore_HundredFive: iconName = MallDefine.GetCurrencyIconNameByType(GameCmd.MoneyType.MoneyType_HuntingCoin); num = (uint)player.GetProp((int)Client.PlayerProp.ShouLieScore); break; } if (null != m_sprite_CurrncyIcon) { UIManager.GetAtlasAsyn(iconName, ref m_currencyCASD, () => { if (null != m_sprite_CurrncyIcon) { m_sprite_CurrncyIcon.atlas = null; } }, m_sprite_CurrncyIcon); } if (null != m_label_CurrncyNum) { m_label_CurrncyNum.text = num.ToString(); } }
public static int GetNum(ClientMoneyType nType) { Client.IPlayer player = Client.ClientGlobal.Instance().MainPlayer; if (player == null) { return(0); } int type = 0; if (nType == ClientMoneyType.Wenqian) { type = (int)Client.PlayerProp.Money; } else if (nType == ClientMoneyType.Gold) { type = (int)Client.PlayerProp.Coupon; } else if (nType == ClientMoneyType.YuanBao) { type = (int)Client.PlayerProp.Cold; } else if (nType == ClientMoneyType.JiFen) { type = (int)Client.PlayerProp.Score; } else if (nType == ClientMoneyType.ShengWang) { type = (int)Client.PlayerProp.Reputation; } else if (nType == ClientMoneyType.YinLiang) { type = (int)Client.PlayerProp.YinLiang; } else if (nType == ClientMoneyType.FishingMoney) { type = (int)Client.PlayerProp.FishingMoney; } else if (nType == ClientMoneyType.HuntingCoin) { type = (int)Client.PlayerProp.ShouLieScore; } else if (nType == ClientMoneyType.ChengJiuDian) { type = (int)Client.PlayerProp.AchievePoint; } else if (nType == ClientMoneyType.ZhenYingZhanJiFen) { type = (int)Client.PlayerProp.CampCoin; } if (type == 0) { return(0); } return(player.GetProp(type)); }
void MainPlayStop() { Client.IPlayer player = Client.ClientGlobal.Instance().MainPlayer; if (player != null) { player.SendMessage(Client.EntityMessage.EntityCommand_StopMove, player.GetPos()); Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.ROBOTCOMBAT_SEARCHPATH, false); //关闭自动寻路中 } Controller.CmdManager.Instance().Clear(); //清除寻路 }
/// <summary> /// 是否满足等级要求 /// </summary> /// <param name="lv"></param> /// <returns></returns> public static bool IsMatchPalyerLv(int lv) { Client.IPlayer player = DataManager.Instance.MainPlayer; if (null == player) { return(false); } int plv = player.GetProp((int)Client.CreatureProp.Level); return(plv >= lv); }
/// <summary> /// 当前职业是否匹配 /// </summary> /// <param name="job"></param> /// <returns></returns> public static bool IsMatchPalyerJob(int job) { Client.IPlayer player = DataManager.Instance.MainPlayer; if (null == player) { return(false); } int pjob = player.GetProp((int)Client.PlayerProp.Job); return(job == 0 || (job == pjob)); }
/// <summary> /// 职业 /// </summary> /// <returns></returns> public static int Job() { Client.IPlayer player = DataManager.Instance.MainPlayer; if (null == player) { return(0); } int pjob = player.GetProp((int)Client.PlayerProp.Job); return(pjob); }
//自己 private void OnSceneLoadCompelete(int nEventId, object param) { Client.stLoadSceneComplete loadScene = (Client.stLoadSceneComplete)param; uint nMapID = (uint)loadScene.nMapID; m_nCurMapID = nMapID; table.MapDataBase mapDB = GameTableManager.Instance.GetTableItem <table.MapDataBase>(nMapID); if (mapDB == null) { return; } if (mapDB.dwMaterial == 0) { // 使用默认材质 Client.IPlayer pPlayer = Client.ClientGlobal.Instance().MainPlayer; if (pPlayer != null) { // 时装id uint uSuit = 0; List <GameCmd.SuitData> lstSuit = null; pPlayer.GetSuit(out lstSuit); if (lstSuit.Count > 0) { uSuit = lstSuit[0].baseid; ApplyMaterial(pPlayer, uSuit); } } } else { table.ResourceDataBase res = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(mapDB.dwMaterial); if (res == null) { return; } if (res.strPath == "") { return; } Engine.IRenderObj renderObj = Client.ClientGlobal.Instance().MainPlayer.renderObj; if (renderObj != null) { renderObj.ApplyMaterial(res.strPath); } } }
public GameCmd.enumPKMODE GetEntityPkMode(uint uid) { Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error(" EntitySystem is NULL"); return(GameCmd.enumPKMODE.PKMODE_M_NONE); } Client.IPlayer player = es.FindPlayer(uid); if (player != null) { int currMode = player.GetProp((int)Client.PlayerProp.PkMode); return((GameCmd.enumPKMODE)currMode); } return(GameCmd.enumPKMODE.PKMODE_M_NONE); }
public void RideDownRide(Action <object> callback = null, object param = null) { Client.IPlayer mainPlayer = Client.ClientGlobal.Instance().MainPlayer; if (mainPlayer != null) { // bool bRide = (bool)mainPlayer.SendMessage(Client.EntityMessage.EntityCommond_IsRide, null); bool bRide = DataManager.Manager <RideManager>().IsRide; if (!bRide) { if (callback != null) { callback(param); } return; } } RideMgr.UnRideCallback = callback; RideMgr.UnRideCallbackParam = param; NetService.Instance.Send(new stDownRideUserCmd_C() { }); }
// 创建玩家的预览对象 public IRenerTextureObj CreateRenderTextureObj(Client.IPlayer player, int nSize) { if (player == null) { return(null); } if (renderTexturePool == null) { return(null); } RenderTextureObj obj = new RenderTextureObj(++m_uIDSeed); if (!obj.Create(player, nSize, renderTexturePool, (Client.SkillSettingState)player.GetProp((int)Client.PlayerProp.SkillStatus))) { obj = null; return(null); } obj.SetYOffset(obj.GetID() * 10); return((IRenerTextureObj)obj); }
/// <summary> /// 执行跳过 /// </summary> private void DoJump() { if (m_dialogInfo != null) { if (m_dialogInfo.talkVoice != null && m_dialogInfo.lstTalks.Count == m_dialogInfo.talkVoice.Length) { if (m_nindex == m_dialogInfo.talkVoice.Length - 1) { JumpEnd(); return; } Engine.IAudio audio = Engine.RareEngine.Instance().GetAudio(); if (audio != null && m_nPlayingAudioId != 0) { audio.StopEffect(m_nPlayingAudioId); } table.ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(m_dialogInfo.talkVoice[m_dialogInfo.lstTalks.Count - 1]); if (resDB == null) { Engine.Utility.Log.Error("找不到选择角色的Mp3资源"); } if (audio != null && resDB != null) { //m_nPlayingAudioId = audio.PlayUIEffect(resDB.strPath); Client.IPlayer mainPlayer = Client.ClientGlobal.Instance().MainPlayer; Transform tf = mainPlayer.GetTransForm(); if (tf != null) { m_nPlayingAudioId = audio.PlayEffect(tf.gameObject, resDB.strPath, false, true); } } } } JumpEnd(); }
bool ShowTalkStr(int nindex) { bool success = false; if (m_dialogInfo != null) { if (m_dialogInfo.buttons != null) { if (m_dialogInfo.buttons.Count < 2) { StopAllCoroutines(); //倒计时 tempTime = 0; CLOSETIME = CONST_TASK_CD; m_label_LabelNext.gameObject.SetActive(true); m_label_LabelNext.text = ((int)CLOSETIME).ToString() + "秒后自动跳过"; StartCoroutine(WaitToClose()); } else { m_label_LabelNext.gameObject.SetActive(false); } } } ResetDes(); if (m_dialogInfo != null) { if (m_dialogInfo.lstTalks != null) { if (nindex < m_dialogInfo.lstTalks.Count) { LangTalkData.Talk talkInfo = m_dialogInfo.lstTalks[nindex]; if (talkInfo.bUser) { string name = ""; if (Client.ClientGlobal.Instance().MainPlayer != null) { name = Client.ClientGlobal.Instance().MainPlayer.GetName(); } m_label_nameLabel.text = name; ShowRoleTexture(true); } else { table.NpcDataBase npcdata = GameTableManager.Instance.GetTableItem <table.NpcDataBase>(m_dialogInfo.nNpcId); if (npcdata != null) { ShowRoleTexture(false, npcdata); m_label_nameLabel.text = npcdata.strName; } } bool useRichText = false;//富文本有泄漏bug 暂时不用 if (useRichText) { string desc = string.Format("<size value=\"24\"><color value=\"#1c2850\">{0} </color></size>", talkInfo.strText); if (uiXmlRichText != null) { this.uiXmlRichText.fontSize = 24; this.uiXmlRichText.AddXml(RichXmlHelper.RichXmlAdapt(desc)); } } else { string desc = string.Format("[1c2850]{0}[-]", talkInfo.strText); m_label_normalText.text = desc; } success = true; } } if (m_dialogInfo.talkVoice != null && nindex < m_dialogInfo.talkVoice.Length) { Engine.IAudio audio = Engine.RareEngine.Instance().GetAudio(); if (audio != null && m_nPlayingAudioId != 0) { audio.StopEffect(m_nPlayingAudioId); } table.ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(m_dialogInfo.talkVoice[nindex]); if (resDB == null) { Engine.Utility.Log.Error("找不到选择角色的Mp3资源"); } if (audio != null && resDB != null) { //m_nPlayingAudioId = audio.PlayUIEffect(resDB.strPath); Client.IPlayer mainPlayer = Client.ClientGlobal.Instance().MainPlayer; if (mainPlayer != null) { Transform tf = mainPlayer.GetTransForm(); if (tf != null) { m_nPlayingAudioId = audio.PlayEffect(tf.gameObject, resDB.strPath, false, true); } } } } } //是否显示下一个 //bool nextVisible = (null != m_dialogInfo // && null != m_dialogInfo.lstTalks // && (m_dialogInfo.lstTalks.Count > nindex + 1)); //if (null != m_label_LabelNext && m_label_LabelNext.gameObject.activeSelf != nextVisible) //{ // m_label_LabelNext.gameObject.SetActive(nextVisible); //} return(success); }
private void MovieEnd() { string strCameraName = "MainCamera"; Engine.ICamera cam = Engine.RareEngine.Instance().GetRenderSystem().GetCamera(ref strCameraName); if (cam == null) { return; } CameraFollow.Instance.camera = null; Vector3 savePos = new Vector3(-28.52f, 97.2f, -121.51f); Client.IPlayer pPlayer = Client.ClientGlobal.Instance().MainPlayer; if (pPlayer == null) { return; } newPos = cam.GetNode().GetWorldPosition(); newPos.y = 49.36f; cam.GetNode().GetTransForm().position = savePos; //旋转 Vector3 rotationVector3 = new Vector3(34.923f, 52.184f, 1.782f); Quaternion rotation = Quaternion.Euler(rotationVector3); cam.GetNode().GetTransForm().rotation = rotation; cam.SetFieldOfView(30); RenderSettings.fogStartDistance = 60f; RenderSettings.fogEndDistance = 250f; // 3 秒内 旋转角度 到(38f, 45f, 0f) //cam.GetNode().GetTransForm().DORotate(new Vector3(38f, 45f, 0f), 3); //float fieldOfView = 30; //Tween t = DOTween.To(() => fieldOfView, x => fieldOfView = x, 45, 3); //// 给执行 t 变化时,每帧回调一次 UpdateTween 方法 //t.OnUpdate(() => UpdateTween(fieldOfView)); //float fFogStartDistance = 60; //float fFogEndDistance = 250; //RenderSettings.fogStartDistance = fFogStartDistance; //RenderSettings.fogEndDistance = fFogEndDistance; //Tween t1 = DOTween.To(() => fFogStartDistance, x => fFogStartDistance = x, 20, 3); //t1.OnUpdate(() => UpdateFogStartDistance(fFogStartDistance)); //Tween t2 = DOTween.To(() => fFogEndDistance, x => fFogEndDistance = x, 170, 3); //t2.OnUpdate(() => UpdateFogEndDistance(fFogEndDistance)); //Tweener tweener = cam.GetNode().GetTransForm().DOMove(newPos, 3f); UIManager.Instance.SetCameraState(false); Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem(); if (cs != null) { cs.GetActiveCtrl().SetHost(null); } Invoke("MovieEnd_Impl", 2f); }
private void MovieEnd_Impl() { string strCameraName = "MainCamera"; Engine.ICamera cam = Engine.RareEngine.Instance().GetRenderSystem().GetCamera(ref strCameraName); if (cam == null) { return; } ///rotate cam.GetNode().GetTransForm().DORotate(new Vector3(38f, 45f, 0f), 3); ///fieldofview float fieldOfView = 30; Tween t = DOTween.To(() => fieldOfView, x => fieldOfView = x, 45, 3); // 给执行 t 变化时,每帧回调一次 UpdateTween 方法 t.OnUpdate(() => UpdateTween(fieldOfView)); /// fog float fFogStartDistance = 60; float fFogEndDistance = 250; RenderSettings.fogStartDistance = fFogStartDistance; RenderSettings.fogEndDistance = fFogEndDistance; Tween t1 = DOTween.To(() => fFogStartDistance, x => fFogStartDistance = x, 20, 3); t1.OnUpdate(() => UpdateFogStartDistance(fFogStartDistance)); Tween t2 = DOTween.To(() => fFogEndDistance, x => fFogEndDistance = x, 170, 3); t2.OnUpdate(() => UpdateFogEndDistance(fFogEndDistance)); // move Tweener tweener = cam.GetNode().GetTransForm().DOMove(newPos, 3f); //Audio table.ResourceDataBase rdb = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(45001); if (rdb != null) { PlayAudio(this.gameObject, rdb.strPath); } // Client.IPlayer pPlayer = Client.ClientGlobal.Instance().MainPlayer; if (pPlayer == null) { return; } tweener.OnComplete(() => { CameraFollow.Instance.camera = cam; pPlayer = Client.ClientGlobal.Instance().MainPlayer; CameraFollow.Instance.target = pPlayer; cam.SetCameraCtrl(CameraFollow.Instance); cam.SetFarClipPlane(140); if (post != null) { GameObject.DestroyImmediate(post); post = null; } UIManager.Instance.SetCameraState(true); Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem(); if (cs != null) { cs.GetActiveCtrl().SetHost(pPlayer); } Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.CAMERA_MOVE_END, null); }); }
void ShowRoleTexture(bool bPlayer, table.NpcDataBase npcDb = null) { if (m_RTObj != null) { m_RTObj.Release(); } if (bPlayer) { m_RTObj = DataManager.Manager <RenderTextureManager>().CreateRenderTextureObj(MainPlayerHelper.GetMainPlayer(), 700); } else if (npcDb != null) { m_RTObj = DataManager.Manager <RenderTextureManager>().CreateRenderTextureObj((int)npcDb.dwViewModelSet, 700); } if (m_RTObj == null) { return; } if (bPlayer) { Client.IPlayer player = MainPlayerHelper.GetMainPlayer(); if (player == null) { return; } uint job = (uint)player.GetProp((int)Client.PlayerProp.Job); int sex = (int)player.GetProp((int)Client.PlayerProp.Sex); table.SelectRoleDataBase roleSelectData = GameTableManager.Instance.GetTableItem <table.SelectRoleDataBase>(job, sex); float offsety = 1.5f; float distance = 1.7f; float rotateX = 0f; if (roleSelectData != null) { offsety = roleSelectData.offsetY * 0.01f; distance = roleSelectData.distance * 0.01f; rotateX = roleSelectData.diaRotateX * 0.01f; } m_RTObj.SetCamera(new Vector3(0f, offsety, 0), new Vector3(rotateX, 0, 0), distance); //m_RTObj.SetCamera(new Vector3(0f, offsety, 0), Vector3.zero, distance); } else { float offsety = 1.0f; float distance = 1.7f; float rotateX = 0f; if (npcDb != null) { offsety = npcDb.diaOffsetY * 0.01f; distance = npcDb.diaDistance * 0.01f; rotateX = npcDb.diaRotateX * 0.01f; } m_RTObj.SetCamera(new Vector3(0f, offsety, 0), new Vector3(rotateX, 0, 0), distance); //m_RTObj.SetCamera(new Vector3(0f, offsety, 0), Vector3.zero, distance); } rotateY = 170f; //设置人物旋转 m_RTObj.SetModelRotateY(rotateY); m_RTObj.PlayModelAni(Client.EntityAction.Stand); //人物 if (m__NpcTexture != null) { m__NpcTexture.mainTexture = m_RTObj.GetTexture(); //m__NpcTexture.MakePixelPerfect(); } }