/// <summary> /// 出战 /// </summary> void OnClickFightBtn(GameObject go) { bool iscanFight = true; FDictionary mercenaryInfoList = GameCenter.mercenaryMng.mercenaryInfoList; if (curInfo != null) { if (curInfo.IsActive == 2) { GameCenter.messageMng.AddClientMsg(250); iscanFight = false; return; } } //foreach (MercenaryInfo info in mercenaryInfoList.Values) //{ // if (info.IsActive == 1) // { // MessageST mst = new MessageST(); // mst.messID = 144; // GameCenter.messageMng.AddClientMsg(mst); // iscanFight = false; // break; // } //} if (iscanFight) { GameCenter.mercenaryMng.C2S_ReqMercenaryInfo(PetChange.FINGHTING, GameCenter.mercenaryMng.curPetId); } }
static void FilterProject(string projectName, string path) { // 获得项目文件集合 FDictionary <SFileInfo> infos = new FDictionary <SFileInfo>(); foreach (string fileName in RDirectory.ListFiles(path)) { if (fileName.EndsWith(".h") || fileName.EndsWith(".cpp")) { string formatName = fileName.Replace('\\', '/'); string name = RString.Right(formatName, "/"); SFileInfo info = new SFileInfo(); info.fileName = formatName; info.include = false; infos.Set(name, info); } } // 查找使用中的文件集合 string configFileName = path + "/vcproject/" + projectName + ".vcxproj"; FXmlDocument document = new FXmlDocument(configFileName); foreach (FXmlNode xnode in document.Root.Nodes) { if (xnode.IsName("ItemGroup")) { foreach (FXmlNode xfile in xnode.Nodes) { if (xfile.IsName("ClInclude") || xfile.IsName("ClCompile")) { string include = xfile.Get("Include"); string name = RString.Right(include, "\\"); SFileInfo info = infos.Find(name); if (info != null) { info.include = true; } } } } } // 查找删除集合 foreach (SFileInfo info in infos.Values) { if (!info.include) { RLogger.Find(typeof(SFileInfo)).Debug(null, "FilterProject", info.fileName); File.Delete(info.fileName); } } // 查找没用目录 RDirectory.Delete(path + "/build"); RDirectory.Delete(path + "/dist"); RDirectory.Delete(path + "/nbproject/private"); RDirectory.Delete(path + "/maproject/libs"); RDirectory.Delete(path + "/maproject/obj"); RDirectory.Delete(path + "/vcproject/Debug"); RDirectory.Delete(path + "/vcproject/Release"); RDirectory.Delete(path + "/vcproject/x64"); File.Delete(path + "/vcproject/" + projectName + ".vcxproj.user"); }
/// <summary> /// 初始化新功能开启数据 /// </summary> public void InitFunctionData() { //functionList.Clear(); //Debug.Log("InitFunctionData()"); FDictionary dic = ConfigMng.Instance.OpenNewFunctionRefTable(); FunctionDataInfo funcInfo = null; foreach (OpenNewFunctionRef data in dic.Values) { if (data.prof > 0 && data.prof != mainPlayerInfo.Prof) { continue; } if (data.func_type > 0) { if (!functionList.ContainsKey(data.func_type)) { funcInfo = new FunctionDataInfo(data); functionList[data.func_type] = funcInfo; } else { funcInfo = functionList[data.func_type] as FunctionDataInfo; funcInfo.Update(); } //Debug.Log("funcInfo.Type:" + funcInfo.Type); } } }
public List <DailyMustDoInfo> GetDailyMustDoItemByType(MustDoType _type) { Dictionary <int, DailyMustDoInfo> livelyDic = new Dictionary <int, DailyMustDoInfo>(); FDictionary livelyRefTable = ConfigMng.Instance.GetLivelyRefTable(); foreach (var item in livelyRefTable.Values) { LivelyRef livelyRef = item as LivelyRef; if (livelyRef != null && livelyRef.type == (int)_type) { DailyMustDoInfo doInfo = null; if (CurLivelyDic.ContainsKey(livelyRef.id)) { doInfo = new DailyMustDoInfo(CurLivelyDic[livelyRef.id]); //有后台数据 } else { doInfo = new DailyMustDoInfo(livelyRef.id); //没有后台数据 } if (livelyDic.ContainsKey(doInfo.Sort)) { livelyDic[doInfo.Sort].UpdateBySort(doInfo); //同类型的只显示一个 } else { livelyDic[doInfo.Sort] = doInfo; } } } List <DailyMustDoInfo> livelyList = new List <DailyMustDoInfo>(livelyDic.Values); livelyList.Sort(SortMustDoInfo); return(livelyList); }
protected override void OnOpen() { base.OnOpen(); RefreshReward(); FDictionary rewardsTable = ConfigMng.Instance.GetCastSoulRefTable(); for (int i = 0; i < items.Length; i++) { if (rewardsTable.Count > i) { items[i].transform.parent.gameObject.SetActive(true); CastSoulRef reward = ConfigMng.Instance.GetCastSoulRef(i + 1); if (reward != null) { if (reward.normalItem.Count > 0) { EquipmentInfo eq = new EquipmentInfo(reward.normalItem[0].eid, reward.normalItem[0].count, EquipmentBelongTo.PREVIEW); items[i].FillInfo(eq); items[i].itemName.text = eq.ItemName + " X " + reward.normalItem[0].count; } } } else { items[i].transform.parent.gameObject.SetActive(false); } } RefreshNeedLev(35); RefreshNeedLev(45); ConfigMng.Instance.GetBigUIIcon("Pic_zh_bg", SetTexture); VIPref = GameCenter.vipMng.VipData.RefData; }
/// <summary> /// 刷新技能弹道(依赖对象池,必须在对象池初始化结束以后使用) by吴江 /// </summary> /// <param name="_id">删除的弹道ID,如果为负数则这次变化为增加弹道</param> protected void RefreshAbilityBallisticCurve(int _id) { if (_id < 0)//增加弹道 by吴江 { FDictionary dataList = sceneMng.AbilityBallisticCurveInfoDictionary; foreach (int item in dataList.Keys) { if (!abilityBallisticCurveDic.ContainsKey(item)) { //从对象池中取出 by吴江 AbilityBallisticCurveInfo info = dataList[item] as AbilityBallisticCurveInfo; if (info != null) { abilityBallisticCurveDic[item] = GameCenter.spawner.SpawnAbilityBallisticCurve(info); } else { Debug.LogError(item + " 弹道数据为空!"); } } } } else//删除弹道 by吴江 { if (abilityBallisticCurveDic.ContainsKey(_id)) { //归还给对象池 by吴江 abilityBallisticCurveDic[_id].needDespawed = true; abilityBallisticCurveDic.Remove(_id); } } }
/// <summary> /// 检查是否仍然在禁止移动状态 by吴江 /// </summary> /// <param name="_deleteBuffID"></param> protected void CheckUnlockMove(int _deleteBuffID) { FDictionary list2 = actorInfo.BuffList; if (list2 == null) { moveFSM.UnLockMoving(); } else { bool hasOtherLock = false; foreach (BuffInfo item in list2.Values) { if (item.BuffTypeID == _deleteBuffID) { continue; } if (item.ContrlType == BuffControlSortType.STUN || item.ContrlType == BuffControlSortType.SLEEP || item.ContrlType == BuffControlSortType.FREEZE || item.ContrlType == BuffControlSortType.BANISH) { hasOtherLock = true; break; } } if (!hasOtherLock) { moveFSM.UnLockMoving(); } } }
void S2C_ActivityDataInfo(Pt _info) { pt_update_activity_info_d715 info = _info as pt_update_activity_info_d715; activity_list data = null; for (int i = 0; i < info.activity_list.Count; i++) { data = info.activity_list[i]; if (activityDic.ContainsKey(data.id)) { activityDic[data.id].Update(data); } else { activityDic[data.id] = new ActivityDataInfo(data); } } FDictionary datalist = ConfigMng.Instance.GetActivityList(); foreach (ActivityListRef refdata in datalist.Values) { //Debug.Log("活动大厅数据" + refdata.name+""); if (!activityDic.ContainsKey(refdata.id)) { activityDic[refdata.id] = new ActivityDataInfo(refdata.id); //Debug.Log("活动大厅数据去构造活动数据"+ activityDic[refdata.id].State); } } if (OnActivityDataInfo != null) { OnActivityDataInfo(); } }
/// <summary> /// 第一次进场景的时候没有移动的时候,不会显示神圣晶石界面 /// </summary> void RefreshHolyFirstLogin() { if(GameCenter.activityMng.GetActivityState(ActivityType.HOLYSPAR) == ActivityState.ONGOING) { FDictionary itemList = GameCenter.sceneMng.SceneItemInfoDictionary; SceneItem holyStone = null; foreach(int key in itemList.Keys) { SceneItemInfo itemInfo = itemList[key] as SceneItemInfo; if(itemInfo.FunctionType == SceneFunctionType.HOLYSTONE) { holyStone = GameCenter.curGameStage.GetSceneItem(itemInfo.ServerInstanceID); break; } } if(holyStone != null) { int distance = (int)((GameCenter.curMainPlayer.transform.position - holyStone.transform.position).sqrMagnitude); if(distance < 144) { if(GameCenter.taskMng.CurSelectToggle != ToggleType.HOLYSTONE) { GameCenter.activityMng.C2S_ReqHolyInfo(); GameCenter.uIMng.CloseGUI(GUIType.TASK); GameCenter.taskMng.SetCurSelectToggle(ToggleType.HOLYSTONE); GameCenter.uIMng.GenGUI(GUIType.TASK,true); } } } } }
void ShowLivelyData() { if (livelyItems != null) { FDictionary livelyReward = ConfigMng.Instance.GetGuildLivelyRewardRefTable(); int index = 0; foreach (GuildLivelyRewardRef reward in livelyReward.Values) { if (livelyItems.Length > index && livelyItems[index] != null) { livelyItems[index].SetData(reward, ShowLivelyBoxReward); } index++; } } int maxCount = ConfigMng.Instance.GetGuildLivelyMaxCount(); if (livelyProgress != null) { livelyProgress.value = Mathf.Min(1f, (float)GameCenter.guildMng.CurLivelyCount / (float)maxCount); } if (livelyCount != null) { livelyCount.text = GameCenter.guildMng.CurLivelyCount.ToString() + "/" + maxCount; } }
/// <summary> /// 清空buff,在切换场景时使用 /// </summary> public virtual void CleanBuff() { if (OnBuffUpdate != null) { foreach (BuffInfo item in buffList.Values) { if (item.MapCleanType == BuffMapCleanType.CLEAN) { OnBuffUpdate(item.BuffTypeID, false); } } } FDictionary tempBuffList = new FDictionary(); foreach (BuffInfo item in buffList.Values) { if (item.MapCleanType != BuffMapCleanType.CLEAN) { tempBuffList[item.BuffTypeID] = item; } } buffList = tempBuffList; // if (OnCleanBuff != null) // { // OnCleanBuff(); // } }
void Show() { FDictionary battleFieldRefTable = ConfigMng.Instance.GetBattleFieldRefTable(); foreach (BattleFieldRef battleFieldRef in battleFieldRefTable.Values) { BattleComentUi item = null; int id = battleFieldRef.id; if (!allItems.TryGetValue(id, out item)) { if (grid != null) { item = battleComentUi.CreateNew(grid.transform); } allItems[id] = item; } item = allItems[id]; if (item != null) { item.battleFieldRef = battleFieldRef; item.gameObject.SetActive(true); } } if (grid != null) { grid.repositionNow = true; } }
//============================================================ // <T>加载子目录。</T> //============================================================ protected bool LoadSubFolder(FDictionary <FRsResource> resources, FRsResourceFolder folder) { // 判断是否为空 if (null == folder) { return(false); } // 加载子目录 foreach (FRsResourceFolder subFolder in folder.Folders) { if (null != subFolder) { LoadSubFolder(resources, subFolder as FRsResourceFolder); } } foreach (FRsResource cfgObject in folder.Resources) { if (null != cfgObject) { //cfgObject.Tag = new SDsResourceTag(); //resources.Set(cfgObject.Code, cfgObject); } } return(true); }
void Awake() { mutualExclusion = true; layer = GUIZLayer.NORMALWINDOW; if (closeBtn != null) { UIEventListener.Get(closeBtn.gameObject).onClick = OnCloseWnd; } everydayRewardTable = ConfigMng.Instance.GetEverydayRewardTable(); #region 礼包领取 giftDic = ConfigMng.Instance.GetCdKeyRefTable(); giftGo.SetActive(false); rewardGo.SetActive(false); if (getRewardBtn != null) { UIEventListener.Get(getRewardBtn.gameObject).onClick = delegate { if (inputCdKey.value == string.Empty) { GameCenter.messageMng.AddClientMsg(175); } else { GameCenter.rankRewardMng.C2S_ReqGetGiftReward(inputCdKey.value); } } } ; #endregion }
/// <summary> /// 沉默 /// </summary> /// <param name="_silent"></param> /// <param name="_info"></param> protected void Silent(bool _silent, BuffInfo _info) { FDictionary list = actorInfo.BuffList; if (list == null || list.Count == 0) { IsSilent = false; return; } if (_silent) { ForceCancelAbility(); IsSilent = true; } else { bool hasOtherSilent = false; foreach (BuffInfo item in list.Values) { if (item == _info) { continue; } if (item.ContrlType == BuffControlSortType.SILENT) { hasOtherSilent = true; break; } } if (!hasOtherSilent) { IsSilent = false; } } }
protected FDictionary GetFriendTypeDic() { FDictionary dic = new FDictionary(); switch (friendType) { case 0: if (GameCenter.friendsMng.allFriendDic.ContainsKey(1)) { dic = GameCenter.friendsMng.allFriendDic[1]; } break; case 1: if (GameCenter.swornMng.data != null) { List <st.net.NetBase.brothers_list> list = GameCenter.swornMng.data.brothers; for (int i = 0, max = list.Count; i < max; i++) { FriendsInfo info = new FriendsInfo(list[i]); if (!dic.ContainsKey(info.configId) && info.configId != GameCenter.mainPlayerMng.MainPlayerInfo.ServerInstanceID) { dic[info.configId] = info; } } } break; case 2: if (GameCenter.coupleMng.coupleData != null) { FriendsInfo info = new FriendsInfo(GameCenter.coupleMng.coupleData); dic[info.configId] = info; } break; case 3: if (GameCenter.friendsMng.allFriendDic.ContainsKey(4)) { dic = GameCenter.friendsMng.allFriendDic[4]; } break; case 4: if (GameCenter.friendsMng.allFriendDic.ContainsKey(3)) { dic = GameCenter.friendsMng.allFriendDic[3]; } break; default: if (GameCenter.friendsMng.allFriendDic.ContainsKey(1)) { dic = GameCenter.friendsMng.allFriendDic[1]; } break; } return(dic); }
protected void RefreshTeam() { for (int i = 0; i < teamMemberList.Length; i++) { if (teamMemberList[i] != null) teamMemberList[i].gameObject.SetActive(false); } for (int i = 0; i < othersList.Count; i++) { othersList[i].gameObject.SetActive(false); } if (othersParent != null)othersParent.SetActive(false); if (teamParent != null)teamParent.gameObject.SetActive(false); if (GameCenter.teamMng.isInTeam) { joinTeamBtn.SetActive(false); FDictionary memberDic = GameCenter.teamMng.TeammatesDic; if(memberDic.Count == 1)//队伍中只有自己 { if(dissolveTeamBtn != null)dissolveTeamBtn.SetActive(true); }else { if (teamParent != null) teamParent.gameObject.SetActive(true); if(dissolveTeamBtn != null)dissolveTeamBtn.SetActive(false); int index = 0; foreach (TeamMenberInfo item in memberDic.Values) { if(item.baseInfo.uid == GameCenter.mainPlayerMng.MainPlayerInfo.ServerInstanceID) continue; if (teamMemberList.Length > index && teamMemberList[index] == null) { teamMemberList[index] = (teamMemberInstance.CreateNew(teamParent.transform, index)); } UIEventListener.Get(teamMemberList[index].gameObject).onClick -= OnClickTeamMemBtn; UIEventListener.Get(teamMemberList[index].gameObject).onClick += OnClickTeamMemBtn; teamMemberList[index].gameObject.SetActive(true); teamMemberList[index].SetInfo(item); UIEventListener.Get(teamMemberList[index].gameObject).parameter = item; index++; } } } else { joinTeamBtn.SetActive(true); if(dissolveTeamBtn != null)dissolveTeamBtn.SetActive(false); } teamParent.repositionNow = true; if (teamTable != null) teamTable.repositionNow = true; if (othersParent != null) { othersParent.SetActive(true); } RefreshOthers(); }
static RAdManager() { _configs = new FDictionary <FAdObjectConfig>(); /*foreach(FXmlNode node in _resource.Config.Nodes){ * if (node.IsName(FAdObjectConfig.TAG)) { * FAdObjectConfig config = new FAdObjectConfig(); * config.LoadConfig(node); * _configs[config.Name] = config; * } * }*/ }
void Awake() { mutualExclusion = true; Layer = GUIZLayer.NORMALWINDOW; dataList = ConfigMng.Instance.GetVIPRefTable(); if (etyVipItem != null) { uiGrid = etyVipItem.transform.parent.GetComponent <UIGrid>(); etyVipItem.SetActive(false); } CreateVipLev(); }
//============================================================ public override void Serialize(IOutput output) { base.Serialize(output); // 存储属性 output.WriteInt8((sbyte)_optionLoaded); output.WriteInt8((sbyte)_optionSelect); output.WriteInt8((sbyte)_optionGround); output.WriteInt8((sbyte)_optionMergeVertex); output.WriteInt8((sbyte)_optionMergeMaterial); output.WriteInt8((sbyte)_optionLightMap); //............................................................ // 统计材质次数 FDictionary <int> materialsCount = new FDictionary <int>(); foreach (FDrTemplateRenderable renderable in _renderables) { int materialCount = 0; if (materialsCount.Contains(renderable.MaterialCode)) { materialCount = materialsCount.Get(renderable.MaterialCode); } materialCount++; materialsCount.Set(renderable.MaterialCode, materialCount); } //............................................................ // 存储渲染列表 int count = _renderables.Count; output.WriteInt16((short)count); for (int n = 0; n < count; n++) { FDrTemplateRenderable renderable = _renderables[n]; int materialCount = materialsCount.Get(renderable.MaterialCode); if (1 == materialCount) { renderable.OptionMerge = EDrFlag.No; } renderable.Id = n + 1; renderable.Serialize(output); } //............................................................ // 存储动画列表 if (_animation.IsEmpty) { output.WriteBool(false); } else { output.WriteBool(true); _animation.Serialize(output); } }
void SortMaigcData() { FDictionary table = ConfigMng.Instance.GetRefineRefTable(); foreach (RefineRef data in table.Values) { if (data.relationID == 1) { list.Add(data); } } list.Sort(SortMagic); }
/// <summary> /// 持续行为 by吴江 /// </summary> /// <param name="_silent"></param> /// <param name="_buffID"></param> protected void Durative(bool _durative, BuffInfo _info) { //会 if (fxCtrl != null) { if (_durative) { fxCtrl.DoBuffEffect(_info.EffectName, animationRoot); } else { fxCtrl.HideBuffEffect(_info.EffectName); } } //会 FDictionary list = actorInfo.BuffList; if (list == null || list.Count == 0) { moveFSM.UnLockMoving(); return; } bool hasOtherDurative = false; string otherDurativeName = _durative ? _info.AnimName : string.Empty; int curLevel = _durative ? _info.AnimLevel : 0; foreach (BuffInfo item in list.Values) { if (item == _info) { continue; } if (item.AnimLevel > curLevel && item.AnimName.Length > 0) { otherDurativeName = item.AnimName; curLevel = item.AnimLevel; hasOtherDurative = true; } } if (animFSM != null) { if ((!_durative && !hasOtherDurative)) { animFSM.StopDurative(); } else if (otherDurativeName != string.Empty) { animFSM.Durative(otherDurativeName, 999999, WrapMode.Loop); //这里对导致战士灭地技能切场景后继续做动作 by邓成 } } }
void ShowDonateType() { FDictionary dic = ConfigMng.Instance.GetGuildDonateRefTable(); int i = 0; foreach (GuildDonateRef donate in dic.Values) { if (types.Length > i) { types[i].SetData(donate); ++i; } } }
/// <summary> /// 获取路径最近的怪物 /// </summary> /// <param name="_gameStage"></param> /// <param name="_player"></param> /// <param name="_needAlive"></param> /// <returns></returns> public static Monster GetClosestMob(this GameStage _gameStage, SmartActor _player, ref float _distance) { List <Monster> mobs = _gameStage.GetMobs(); FDictionary distanceDic = new FDictionary(); FDictionary mobDic = new FDictionary(); int selfCamp = _player.Camp; SceneType sceneType = GameCenter.curGameStage.SceneType; Vector3 selfPosition = _player.transform.position; for (int i = 0; i < mobs.Count; i++) { Monster mob = mobs[i]; if (mob.isDummy || !mob.IsShowing || mob.isDead) { continue; } if (mob.gameObject != null && !mob.isDead && !mob.IsActor && ConfigMng.Instance.GetRelationType(selfCamp, mob.Camp, sceneType) == RelationType.AUTOMATEDATTACKS) { Vector3[] path = GameStageUtility.StartPath(selfPosition, mob.transform.position); if (path != null) { if (path.Length != 2) { distanceDic.Add(mob.id, path.CountPathDistance());//距离计算方法改变 } else { distanceDic.Add(mob.id, Vector3.Distance(selfPosition, mob.transform.position)); } mobDic.Add(mob.id, mob); } } } int closestOne = -1; float distance = -1; foreach (int id in distanceDic.Keys) { if (distance < 0 || distance >= (float)distanceDic[id]) { closestOne = id; distance = (float)distanceDic[id]; _distance = distance; } } return(mobDic.ContainsKey(closestOne) ? mobDic[closestOne] as Monster : null); }
void RefreshFirendWnd() { for (int i = 0, max = friendTypeTog.Length; i < max; i++) { if (friendTypeTog[i].value) { friendType = i; } } if (grid != null) { grid.transform.DestroyChildren(); } FDictionary dic = GetFriendTypeDic(); if (dic.Count < 1) { SetNullFriend(false); return; } if (firendInstantiate == null) { return; } Vector3 V3 = Vector3.zero; SetNullFriend(true); foreach (FriendsInfo item in dic.Values) { if (firendInstantiate != null) { GameObject obj = Instantiate(firendInstantiate) as GameObject; if (obj != null) { obj.SetActive(true); obj.transform.parent = grid.transform; obj.transform.localPosition = V3; obj.transform.localScale = Vector3.one; obj.GetComponent <ChatFirendUI>().FillInfo(item); V3 = new Vector3(V3.x, V3.y - 105, V3.z); } } } if (scrollView != null) { scrollView.ResetPosition(); } }
protected void Refresh() { FDictionary loginPlayerDic = GameCenter.loginMng.LoginPlayerDic; int index = 0; foreach (PlayerBaseInfo item in loginPlayerDic.Values) { if (index >= selectPlayerStructArray.Length) { break; } selectPlayerStructArray[index].Refresh(item); index++; } }
void ShowMountInfo() { //显示幻兽信息 if (MountRefDate != null) { int id = MountRefDate.mountId; FDictionary mountSkinInfoDic = GameCenter.newMountMng.mountSkinList; nameLab.text = MountRefDate.mountName; if (item != null) { item.FillInfo(new EquipmentInfo(MountRefDate.itemID, EquipmentBelongTo.PREVIEW)); item.itemName.gameObject.SetActive(false); if (item.itemIcon.GetComponent <UISpriteEx>() != null) { item.itemIcon.GetComponent <UISpriteEx>().IsGray = UISpriteEx.ColorGray.normal; } if (!mountSkinInfoDic.ContainsKey(id)) { if (item.itemIcon.GetComponent <UISpriteEx>() != null) { item.itemIcon.GetComponent <UISpriteEx>().IsGray = UISpriteEx.ColorGray.Gray; } } else { //MountInfo skin = mountSkinInfoDic[id] as MountInfo; } } if (mountSkinInfoDic.ContainsKey(id))//该皮肤玩家已经拥有 { MountInfo info = mountSkinInfoDic[id] as MountInfo; if (info.SkinRemainTime != 0)//限时 { timer.StartIntervalTimer(info.SkinRemainTime); timer.onTimeOut = (x) => { timeLab.text = ConfigMng.Instance.GetUItext(84); }; } else//这个幻兽是永久拥有的 { timeLab.gameObject.SetActive(false); } return; } timeLab.text = ConfigMng.Instance.GetUItext(84); } }
/// <summary> /// 获取路径最近指定关系随从 by吴江 /// </summary> /// <param name="_gameStage"></param> /// <param name="_player"></param> /// <param name="_needAlive"></param> /// <returns></returns> public static OtherEntourage GetClosestEntourage(this GameStage _gameStage, SmartActor _player, RelationType _relationType, ref float _distance) { List <OtherEntourage> opcs = _gameStage.GetOtherEntourages(); FDictionary distanceDic = new FDictionary(); FDictionary opcDic = new FDictionary(); int selfCamp = _player.Camp; SceneType sceneType = GameCenter.curGameStage.SceneType; Vector3 selfPosition = _player.transform.position; for (int i = 0; i < opcs.Count; i++) { OtherEntourage opc = opcs[i]; if (opc.isDummy || !opc.IsShowing) { continue; } if (opc.gameObject != null && !opc.isDead && !opc.IsActor && ConfigMng.Instance.GetRelationType(selfCamp, opc.Camp, sceneType) == _relationType) { Vector3[] path = GameStageUtility.StartPath(selfPosition, opc.transform.position); if (path != null) { if (path.Length != 2) { distanceDic.Add(opc.id, path.CountPathDistance());//距离计算方法改变 } else { distanceDic.Add(opc.id, Vector3.Distance(selfPosition, opc.transform.position)); } opcDic.Add(opc.id, opc); } } } int closestOne = -1; float distance = -1; foreach (int id in distanceDic.Keys) { if (distance < 0 || distance >= (float)distanceDic[id]) { closestOne = id; distance = (float)distanceDic[id]; _distance = distance; } } return(opcDic.ContainsKey(closestOne) ? opcDic[closestOne] as OtherEntourage : null); }
public void Update(pt_reply_login_dividend_info_d981 _info) { this.details.Clear(); this.id = 66; this.type = 66; FDictionary dic = ConfigMng.Instance.GetDividendRefTable(); foreach (DividendRef info in dic.Values)//已经领取的天数 { WdfActiveDetailsData data = new WdfActiveDetailsData(info, (int)_info.active_days, _info.reward_ids); if (data != null) { this.details.Add(data); } } }
/// <summary> /// 获取路径最近的怪物 /// </summary> /// <param name="_gameStage"></param> /// <param name="_player"></param> /// <param name="_needAlive"></param> /// <returns></returns> public static SmartActor GetClosestSmartActor(PlayerBase _player, List <SmartActor> smartActors, RelationType _relationType, ref float _instance) { List <SmartActor> smActors = smartActors; FDictionary distanceDic = new FDictionary(); FDictionary mobDic = new FDictionary(); int selfCamp = _player.Camp; SceneType sceneType = GameCenter.curGameStage.SceneType; Vector3 selfPosition = _player.transform.position; for (int i = 0; i < smActors.Count; i++) { SmartActor smActor = smActors[i]; if (smActor.gameObject != null && !smActor.isDead && !smActor.IsActor && ConfigMng.Instance.GetRelationType(selfCamp, smActor.Camp, sceneType) == _relationType) { Vector3[] path = GameStageUtility.StartPath(selfPosition, smActor.transform.position); if (path != null) { if (path.Length != 2) { distanceDic.Add(smActor.id, path.CountPathDistance());//距离计算方法改变 } else { distanceDic.Add(smActor.id, Vector3.Distance(selfPosition, smActor.transform.position)); } mobDic.Add(smActor.id, smActor); } } } int closestOne = -1; float distance = -1; foreach (int id in distanceDic.Keys) { if (distance < 0 || distance >= (float)distanceDic[id]) { closestOne = id; distance = (float)distanceDic[id]; } } _instance = distance; return(mobDic.ContainsKey(closestOne) ? mobDic[closestOne] as SmartActor : null); }
public Font() { dictionary= new FDictionary<char, Glyph>(); ovaTexture= Texture.NULL; }
// Initiates the game private void preInitGame() { // Variables ModelContentStream mcs; difficulty= 0; pUpdateFunc= defaultUpdateFunc; pRenderFunc= defaultRenderFunc; e_input= null; loadedSounds= new FDictionary<string, Sound>(); loadedTextures= new FDictionary<string, Texture>(); loadedFonts= new FDictionary<string, Font>(); loadedModels= new ModelFactory(); window= new GameFrame(this); GameInput.init(this); content= new ContentManager(); statesys= new GameStateSystem(this); gui= new GUI(this); sounds= new AudioPlayer(this); host= new AServerHost(); mcs= new ModelContentStream(this); content.addReader(new TextureContentReader()); content.addReader(new FontContentReader(this)); content.addReader(new SoundContentReader()); content.addReader(mcs); content.addWriter(mcs); window.viewport.onRender+= render; }