/// <summary> /// 控件激活时 /// </summary> private void OnEnable() { fisrtKeyUP = false; iGameState = GameState.Instance.GetEntity <IGameState>(); iPlayerState = GameState.Instance.GetEntity <IPlayerState>(); iMapState = GameState.Instance.GetEntity <IMapState>(); iNowTaskState = GameState.Instance.GetEntity <INowTaskState>(); npcData = DataCenter.Instance.GetMetaData <NPCData>(); PlayerState playerState = DataCenter.Instance.GetEntity <PlayerState>(); playerState.UpdateMapMaskData(iGameState.SceneName); runTimeTasksData = DataCenter.Instance.GetEntity <RuntimeTasksData>(); UIManager.Instance.KeyUpHandle += Instance_KeyUpHandle; UIManager.Instance.KeyPressHandle += Instance_KeyPressHandle; bigMapOperateState = EnumBigMapOperateState.OperateMap; showSettingPanel.gameObject.SetActive(false); ResetSceneDropDown(); //ResetMap(iMapState.MapBackSprite, iMapState.MaskMapSprite, iMapState.MapRectAtScene, iGameState.SceneName); StartCoroutine(NextFrameInit()); //判断是否是点击路牌打开的该界面.如果是才可以传送 IInteractiveState iInteractiveState = GameState.Instance.GetEntity <IInteractiveState>(); NPCDataInfo npcDataInfo = npcData.GetNPCDataInfo(iGameState.SceneName, iInteractiveState.ClickInteractiveNPCID); if (npcDataInfo != null && npcDataInfo.NPCType == EnumNPCType.Street) { canTransport = true; } else { canTransport = false; } }
private void INowTaskStateChanged(INowTaskState iNowTaskState, string targetName) { //接受任务时调用 if (string.Equals(targetName, GameState.Instance.GetFieldName <INowTaskState, int>(temp => temp.StartTask))) { InterludesData interludesData = DataCenter.Instance.GetMetaData <InterludesData>(); InterludesItemStruct interludesItemStruct = interludesData.GetInterludesItemStructByTaskID(iNowTaskState.StartTask); if (interludesItemStruct != null) { StartInterludes(interludesItemStruct); } else { Debug.Log("该任务没有过场动画"); } } //完成任务时调用 else if (string.Equals(targetName, GameState.Instance.GetFieldName <INowTaskState, int>(temp => temp.OverTaskID))) { InterludesData interludesData = DataCenter.Instance.GetMetaData <InterludesData>(); InterludesItemStruct interludesItemStruct = interludesData.GetInterludesItemStructByTaskID(iNowTaskState.OverTaskID, InterludesItemStruct.EnumInterludesShowTime.Over); if (interludesItemStruct != null) { StartInterludes(interludesItemStruct); } else { Debug.Log("该任务没有过场动画"); } } }
public override void ActionTrigger() { base.ActionTrigger(); if (!torchLightState) { //触发机关 torchLightState = true; if (targetObj) { targetObj.SetActive(true); } //保存状态 SaveDataAction(true); //设置任务状态 INowTaskState iNowTaskState = GameState.Instance.GetEntity <INowTaskState>(); switch (torchIndex) { case 1: iNowTaskState.CheckNowTask(EnumCheckTaskType.Special, (int)TaskMap.Enums.EnumTaskSpecialCheck.DXMG_TorchLight1); break; case 2: iNowTaskState.CheckNowTask(EnumCheckTaskType.Special, (int)TaskMap.Enums.EnumTaskSpecialCheck.DXMG_TorchLight2); break; case 3: iNowTaskState.CheckNowTask(EnumCheckTaskType.Special, (int)TaskMap.Enums.EnumTaskSpecialCheck.DXMG_TorchLight3); break; case 4: iNowTaskState.CheckNowTask(EnumCheckTaskType.Special, (int)TaskMap.Enums.EnumTaskSpecialCheck.DXMG_TorchLight4); break; } } }
/// <summary> /// 任务状态发生变化(词条相关) /// </summary> /// <param name="iNowTaskState"></param> /// <param name="fieldName"></param> private void INowTaskStateChange_Entry(INowTaskState iNowTaskState, string fieldName) { if (string.Equals(fieldName, GameState.GetFieldNameStatic <INowTaskState, int>(temp => temp.OverTaskID))) { CheckEntryTaskOver(iNowTaskState.OverTaskID); } }
private void Init() { if (dialogueStructData == null) { dialogueStructData = DataCenter.Instance.GetMetaData <DialogueStructData>(); } if (runtimeTasksData == null) { runtimeTasksData = DataCenter.Instance.GetEntity <TaskMap.RunTimeTaskData>(); } if (iInteractiveState == null) { iInteractiveState = GameState.Instance.GetEntity <IInteractiveState>(); } if (iNowTaskState == null) { iNowTaskState = GameState.Instance.GetEntity <INowTaskState>(); } if (iGameState == null) { iGameState = GameState.Instance.GetEntity <IGameState>(); } if (iNPCSpriteState == null) { iNPCSpriteState = GameState.Instance.GetEntity <INPCSpriteState>(); } }
/// <summary> /// 当前任务状态发生变化 /// </summary> /// <param name="iNowTaskState"></param> /// <param name="fieldName"></param> private void INowTaskStateChanged(INowTaskState iNowTaskState, string fieldName) { //开始任务 if (string.Equals(fieldName, GameState.GetFieldNameStatic <INowTaskState, int>(temp => temp.StartTask))) { Init(); // 如果存在该任务且该任务是主线 TaskMap.RunTimeTaskInfo runTimeTaskInfo = runtimeTasksData.GetTasksWithID(iNowTaskState.StartTask, true); if (runTimeTaskInfo != null && runTimeTaskInfo.TaskInfoStruct.TaskType == TaskMap.Enums.EnumTaskType.Main && !runTimeTaskInfo.TaskInfoStruct.NeedShowTalk && runTimeTaskInfo.TaskInfoStruct.NeedShowImageTip) { Debug.Log("显示图片提示:" + runTimeTaskInfo.ID); string directoryPath = runTimeTaskInfo.TaskInfoStruct.ShowImageTipDirectoryName; if (!string.IsNullOrEmpty(directoryPath))//该文件夹不为空 { directoryPath = ResourceDirectoryPath + "/" + directoryPath; needShowArray = Resources.LoadAll <Sprite>(directoryPath); if (needShowArray.Length > 0) { gameObject.SetActive(true); //显示面板 nowPage = 0; ShowImageTip(); //显示 } } } } }
/// <summary> /// 等待一定时间销毁 /// </summary> /// <returns></returns> IEnumerator DestoryThis() { //关闭自身的碰撞体 Collider[] colliders = GetComponents <Collider>(); foreach (Collider collider in colliders) { if (collider != null) { GameObject.Destroy(collider); } } yield return(null); //取消注册(其实也可以不用管) if (monsterDataInfo != null && monsterDataInfo.MonsterBaseAttribute != null) { thisAttribute.UnRegistor <IAttributeState>(IAttribute_Changed); } //通知杀死了某种怪物 INowTaskState iNowTaskState = GameState.Instance.GetEntity <INowTaskState>(); if (iNowTaskState != null && monsterDataInfo != null) { iNowTaskState.CheckNowTask(EnumCheckTaskType.Monster, (int)monsterDataInfo.MonsterType); } //移除组件 NavMeshAgent navMeshAgent = gameObject.GetComponent <NavMeshAgent>(); if (navMeshAgent != null) { GameObject.Destroy(navMeshAgent); } Rigidbody rigibody = GetComponent <Rigidbody>(); if (rigibody != null) { GameObject.Destroy(rigibody); } if (monsterDataInfo != null) { yield return(new WaitForSeconds(monsterDataInfo.DeathAnimTime)); } else { yield return(new WaitForSeconds(3)); } float animatorTime = 0; float maxAnimatorTime = monsterDataInfo != null ? monsterDataInfo.DeathAnimTime : 3; while (animatorTime < maxAnimatorTime) { animatorTime += Time.deltaTime; gameObject.transform.position -= Vector3.up * Time.deltaTime * 0.5f; yield return(null); } GameObject.Destroy(gameObject); }
void Start() { verticalLayoutGroup = GetComponent <VerticalLayoutGroup>(); iNowTaskState = GameState.Instance.GetEntity <INowTaskState>(); iMapState = GameState.Instance.GetEntity <IMapState>(); GameState.Instance.Registor <INowTaskState>(INowTaskStateChanged); GameState.Instance.Registor <IMapState>(IMapStateChanged); runTimeTasksData = DataCenter.Instance.GetEntity <TaskMap.RunTimeTaskData>(); ShowNowTask(); }
/// <summary> /// 点击NPC处理任务相关 /// </summary> ///<returns>是否有任务需要处理</returns> private bool ClickNPC_Task() { INowTaskState iNowTaskState = GameState.Instance.GetEntity <INowTaskState>(); //先判断是否完成了任务 bool checkNPCTaskResult = iNowTaskState.CheckNowTask(EnumCheckTaskType.NPC, _ClickInteractiveNPCID); if (checkNPCTaskResult)//如果任务完成了则不用后面的检测了 { return(false); } //如果任务没有完成则需要后面的检测 //接取任务的npcid与点击npcid相同并且存在的任务没有被完成也没有被接取 TaskMap.RunTimeTaskInfo[] runTimeTaskInfos = runtimeTaskData.GetAllToDoList() .Where(temp => temp.TaskInfoStruct.ReceiveTaskNpcId == _ClickInteractiveNPCID && temp.IsOver == false && temp.IsStart == false) .ToArray(); //存在主线任务则展开主线(主线任务在这里直接开始) if (runTimeTaskInfos.Where(temp => temp.TaskInfoStruct.TaskType == TaskMap.Enums.EnumTaskType.Main).Count() > 0) { //INowTaskState iNowTaskState = GameState.Instance.GetEntity<INowTaskState>(); iNowTaskState.StartTask = runTimeTaskInfos.Where(temp => temp.TaskInfoStruct.TaskType == TaskMap.Enums.EnumTaskType.Main).First().ID; return(true); } //如果存在支线则展开支线(支线任务存在选择项,在UI处开始) if (runTimeTaskInfos.Where(temp => temp.TaskInfoStruct.TaskType == TaskMap.Enums.EnumTaskType.Spur).Count() > 0) { if (QueryObj != null) { QueryObj.SetActive(true); } return(true); } //如果存在重复任务则展开重复任务(重复任务存在选择项,在UI处开始) if (runTimeTaskInfos.Where(temp => temp.TaskInfoStruct.TaskType == TaskMap.Enums.EnumTaskType.Repeat).Count() > 0) { if (QueryObj != null) { QueryObj.SetActive(true); } return(true); } //如果不存在任何任务则在人物头顶显示文字 if (TalkShowObj != null) { try { TalkShowObj.SendMessage("ClickInteractiveNPCID"); } catch { Debug.Log("显示人物对话的面板没有ClickInteractiveNPCID函数用来接收消息"); } } return(false); }
private void INowTaskStateChanged(INowTaskState iNowTaskState, string fieldName) { if (string.Equals(fieldName, GameState.Instance.GetFieldName <INowTaskState, int>(temp => temp.StartTask))) { ShowNowTask(); } else if (string.Equals(fieldName, GameState.Instance.GetFieldName <INowTaskState, int>(temp => temp.OverTaskID))) { ShowNowTask(); } }
void Start() { iPlayerState = GameState.Instance.GetEntity <IPlayerState>(); iGameState = GameState.Instance.GetEntity <IGameState>(); iMapState = GameState.Instance.GetEntity <IMapState>(); iNowTaskState = GameState.Instance.GetEntity <INowTaskState>(); npcData = DataCenter.Instance.GetMetaData <NPCData>(); runTimeTasksData = DataCenter.Instance.GetEntity <RuntimeTasksData>(); ResetMap(); GameState.Instance.Registor <IGameState>(IGamgeStateChaged); }
private void OnEnable() { playerState = DataCenter.Instance.GetEntity <PlayerState>(); entryData = DataCenter.Instance.GetMetaData <EntryData>(); UIManager.Instance.KeyUpHandle += Instance_KeyUpHandle; UIManager.Instance.KeyPressHandle += Instance_KeyPressHandle; INowTaskState iNowTaskState = GameState.Instance.GetEntity <INowTaskState>(); iNowTaskState.CheckNowTask(EnumCheckTaskType.Special, (int)TaskMap.Enums.EnumTaskSpecialCheck.OpenEntryUI); InitShow(); }
private void OnEnable() { dialogueStructData = DataCenter.Instance.GetMetaData <DialogueStructData>(); runtimeTasksData = DataCenter.Instance.GetEntity <TaskMap.RunTimeTaskData>(); iInteractiveState = GameState.Instance.GetEntity <IInteractiveState>(); iNowTaskState = GameState.Instance.GetEntity <INowTaskState>(); iGameState = GameState.Instance.GetEntity <IGameState>(); iGameState.PushEnumGameRunType(EnumGameRunType.TaskTalk); showItemList = new List <Transform>(); UIManager.Instance.KeyUpHandle += Instance_KeyUpHandle; InitTalk(); }
private void OnEnable() { UIManager.Instance.KeyUpHandle += Instance_KeyUpHandle; if (uiFocusPath) { nowUIFocus = uiFocusPath.GetFirstFocus(); if (nowUIFocus) { nowUIFocus.SetForcus(); } } //给任务系统填入状态 INowTaskState iNowTaskState = GameState.Instance.GetEntity <INowTaskState>(); iNowTaskState.CheckNowTask(EnumCheckTaskType.Special, (int)TaskMap.Enums.EnumTaskSpecialCheck.OpenItemUI); }
private void OnEnable() { isSaving = false; iGameState = GameState.Instance.GetEntity <IGameState>(); //压入状态 iGameState.PushEnumGameRunType(EnumGameRunType.Setting); UIManager.Instance.KeyUpHandle += Instance_KeyUpHandle; if (uiFocusPath) { nowTabPageFocus = uiFocusPath.GetFirstFocus() as UIFocusTabPage; if (nowTabPageFocus) { nowTabPageFocus.SetForcus(); if (nowTabPageFocus.panel) { nowTabPageFocus.panel.gameObject.SetActive(true); } } } //重新载入数据 //检测此时是否有点击地图的ID(如果是则载入地图标签) IInteractiveState iInteractiveState = GameState.Instance.GetEntity <IInteractiveState>(); NPCData npcData = DataCenter.Instance.GetMetaData <NPCData>(); NPCDataInfo npcDataInfo = npcData.GetNPCDataInfo(iGameState.SceneName, iInteractiveState.ClickInteractiveNPCID); if (npcDataInfo != null && npcDataInfo.NPCType == EnumNPCType.Street) { UIFocusTabPage[] tabPages = uiFocusPath.NewUIFocusArray.OfType <UIFocusTabPage>().ToArray(); var tempUIBigMaps = Enumerable.Range(0, tabPages.Length).Select(temp => new { index = temp, uiBigMap = tabPages[temp].panel.GetComponent <UIBigMap>() }).Where(temp => temp.uiBigMap != null).FirstOrDefault(); if (tempUIBigMaps != null) { ShowIndex(tempUIBigMaps.index); } else { ShowIndex(1);//第一个标签是地图则此处选取第二个标签(属性) } } else//如果不是则载入第一个标签 { ShowIndex(0); } //给任务系统填入状态 INowTaskState iNowTaskState = GameState.Instance.GetEntity <INowTaskState>(); iNowTaskState.CheckNowTask(EnumCheckTaskType.Special, (int)TaskMap.Enums.EnumTaskSpecialCheck.OpenMenuUI); }
private void Init() { if (runtimeTasksData == null) { runtimeTasksData = DataCenter.Instance.GetEntity <TaskMap.RunTimeTaskData>(); } if (iInteractiveState == null) { iInteractiveState = GameState.Instance.GetEntity <IInteractiveState>(); } if (iNowTaskState == null) { iNowTaskState = GameState.Instance.GetEntity <INowTaskState>(); } if (iGameState == null) { iGameState = GameState.Instance.GetEntity <IGameState>(); } }
private void OnEnable() { playerState = DataCenter.Instance.GetEntity <PlayerState>(); iPlayerState = GameState.Instance.GetEntity <IPlayerState>(); roleOfRaceExplanList = new List <KeyValuePair <RoleOfRace, string> >(); FieldExplanAttribute.SetEnumExplanDic(roleOfRaceExplanList); GameState.Instance.Registor <IPlayerAttributeState>(IPlayerAttributeStateChanged); UpdateText(); UIManager.Instance.KeyPressHandle += Instance_KeyPressHandle; UIManager.Instance.KeyUpHandle += Instance_KeyUpHandle; scrollbar.value = 0; uiFocusPath = GetComponent <UIFocusPath>(); UIFocus[] uiFocusArray = uiFocusPath.NewUIFocusArray; foreach (UIFocus uiFocus in uiFocusArray) { uiFocus.SetForcus(); uiFocus.LostForcus(); } //给任务系统填入状态 INowTaskState iNowTaskState = GameState.Instance.GetEntity <INowTaskState>(); iNowTaskState.CheckNowTask(EnumCheckTaskType.Special, (int)TaskMap.Enums.EnumTaskSpecialCheck.OpenAttributeUI); }
/// <summary> /// 当前任务状态发生变化 /// </summary> /// <param name="iNowTaskState"></param> /// <param name="fieldName"></param> private void INowTaskStateChanged(INowTaskState iNowTaskState, string fieldName) { //开始任务 if (string.Equals(fieldName, GameState.GetFieldNameStatic <INowTaskState, int>(temp => temp.StartTask))) { Init(); // 如果存在该任务且该任务是主线 TaskMap.RunTimeTaskInfo runTimeTaskInfo = runtimeTasksData.GetTasksWithID(iNowTaskState.StartTask, true); if (runTimeTaskInfo != null && runTimeTaskInfo.TaskInfoStruct.TaskType == TaskMap.Enums.EnumTaskType.Main && runTimeTaskInfo.TaskInfoStruct.NeedShowTalk && !runTimeTaskInfo.TaskInfoStruct.NeedShowImageTip) { DialogueCondition dialogueCodition = dialogueStructData.SearchDialogueConditionsByNPCID(-1, temp => temp.enumDialogueType == EnumDialogueType.Task && temp.thisTask == iNowTaskState.StartTask).FirstOrDefault(); if (dialogueCodition != null) { gameObject.SetActive(true); //显示面板 InitTalk(dialogueCodition); //初始化对话 } } } else if (string.Equals(fieldName, GameState.GetFieldNameStatic <INowTaskState, int>(temp => temp.OverTaskID))) { Init(); // 如果存在该任务且该任务是主线 TaskMap.RunTimeTaskInfo runTimeTaskInfo = runtimeTasksData.GetTasksWithID(iNowTaskState.OverTaskID, false); if (runTimeTaskInfo != null && runTimeTaskInfo.TaskInfoStruct.TaskType == TaskMap.Enums.EnumTaskType.Main && runTimeTaskInfo.TaskInfoStruct.NeedShowTalk) { Debug.Log("显示结束任务对话:" + runTimeTaskInfo.ID); DialogueCondition dialogueCodition = dialogueStructData.SearchDialogueConditionsByNPCID(-1, temp => temp.enumDialogueType == EnumDialogueType.Task && temp.overTask == iNowTaskState.OverTaskID).FirstOrDefault(); if (dialogueCodition != null) { gameObject.SetActive(true); //显示面板 InitTalk(dialogueCodition); //初始化对话 } } } }
/// <summary> /// 判断任务情况 /// </summary> /// <param name="iNowTaskState"></param> /// <param name="fieldName"></param> private void CheckTask(INowTaskState iNowTaskState) { if (iNowTaskState != null && NPCDataInfo != null && NPCDataInfo.NPCShowCondition != null && runTimeTaskData != null) { NPCDataInfo.NPCShowCondition.TaskCoditionHidePath = false; if (NPCDataInfo.NPCShowCondition.TaskConditionsHide != null && NPCDataInfo.NPCShowCondition.TaskConditionsHide.Length > 0) { foreach (var item in NPCDataInfo.NPCShowCondition.TaskConditionsHide) { TaskMap.RunTimeTaskInfo runtimeTaskInfo = runTimeTaskData.GetTasksWithID(item.TaskID, false); if (runtimeTaskInfo != null && runtimeTaskInfo.TaskProgress == item.TaskState) { NPCDataInfo.NPCShowCondition.TaskCoditionHidePath = true; break; } } } NPCDataInfo.NPCShowCondition.TaskCoditionShowPath = false; if (NPCDataInfo.NPCShowCondition.TaskConditionShow != null && NPCDataInfo.NPCShowCondition.TaskConditionShow.Length > 0) { foreach (var item in NPCDataInfo.NPCShowCondition.TaskConditionShow) { TaskMap.RunTimeTaskInfo runtimeTaskInfo = runTimeTaskData.GetTasksWithID(item.TaskID, false); if (runtimeTaskInfo != null && runtimeTaskInfo.TaskProgress == item.TaskState) { NPCDataInfo.NPCShowCondition.TaskCoditionShowPath = true; break; } } } else { NPCDataInfo.NPCShowCondition.TaskCoditionShowPath = true; } } UpdateShow(); }
private void OnEnable() { iMapState = GameState.Instance.GetEntity <IMapState>(); iNowTaskState = GameState.Instance.GetEntity <INowTaskState>(); UIManager.Instance.KeyUpHandle += Instance_KeyUpHandle; uiTaskList.Init(); //填充任务列表 TaskMap.RunTimeTaskInfo[] runTimeTaskInfoArray = iNowTaskState.GetStartTask(null); //runtimeTaskData.GetAllToDoList().Where(temp => temp.IsStart == true).ToArray(); foreach (TaskMap.RunTimeTaskInfo runTimeTaskInfo in runTimeTaskInfoArray) { TaskMap.TaskInfoStruct taskInfoStruct = runTimeTaskInfo.TaskInfoStruct; UIListItem uiListItem = uiTaskList.NewItem(); uiListItem.value = runTimeTaskInfo; uiListItem.childText.text = taskInfoStruct.TaskTitile; } uiTaskList.UpdateUI(); nowTaskItem = uiTaskList.FirstShowItem(); if (nowTaskItem) { uiTaskList.ShowItem(nowTaskItem); } ExplanNowItem(); }
/// <summary> /// 开始道具的功能 /// 如果是装备则替换,如果是药水则恢复 /// </summary> private void ItemAction() { if (focusUIListItem) { //物品对象 PlayGoods playGoods = (PlayGoods)focusUIListItem.value; EnumGoodsType enumGoodsType = playGoods.GoodsInfo.EnumGoodsType; int goodsTypeInt = (int)enumGoodsType; if (GoodsStaticTools.IsChildGoodsNode(enumGoodsType, EnumGoodsType.Equipment))//如果是装备类型则替换装备 { //如果是副手武器 if (GoodsStaticTools.IsLeftOneHandedWeapon(enumGoodsType)) { //需要判断当前是否佩戴了双手武器以及副手武器(左手武器),如果佩戴了则需要卸载双手武器 PlayGoods[] twoHandedWeapons = playerState.PlayerAllGoods.Where( temp => temp.GoodsLocation == GoodsLocation.Wearing && (GoodsStaticTools.IsTwoHandedWeapon(temp.GoodsInfo.EnumGoodsType) || (temp.leftRightArms != null && temp.leftRightArms.Value == false))).ToArray(); foreach (PlayGoods _playGoods in twoHandedWeapons) { _playGoods.leftRightArms = null; _playGoods.GoodsLocation = GoodsLocation.Package; } playGoods.leftRightArms = false; } //如果是双手武器 else if (GoodsStaticTools.IsTwoHandedWeapon(enumGoodsType)) { //需要判断当前是否佩戴了副手武器以及主手武器(右手武器),如果佩戴了则需要卸载副手武器 PlayGoods[] oneHandedWeapons = playerState.PlayerAllGoods.Where( temp => temp.GoodsLocation == GoodsLocation.Wearing && (GoodsStaticTools.IsLeftOneHandedWeapon(temp.GoodsInfo.EnumGoodsType) || (temp.leftRightArms != null && temp.leftRightArms.Value == true))).ToArray(); foreach (PlayGoods _playGoods in oneHandedWeapons) { _playGoods.leftRightArms = null; _playGoods.GoodsLocation = GoodsLocation.Package; } playGoods.leftRightArms = true; } //如果是饰品 else if (GoodsStaticTools.IsChildGoodsNode(enumGoodsType, EnumGoodsType.Ornaments)) { EnumGoodsType?ornamentsType = GoodsStaticTools.GetParentGoodsType(playGoods.GoodsInfo.EnumGoodsType); //从基础的饰品类型向上跳到饰品的分类类型(项链 戒指 护身符 勋章) if (ornamentsType != null && GoodsStaticTools.IsChildGoodsNode(ornamentsType.Value, EnumGoodsType.Ornaments)) { PlayGoods[] ornaments = playerState.PlayerAllGoods.Where( temp => temp.GoodsLocation == GoodsLocation.Wearing && GoodsStaticTools.IsChildGoodsNode(temp.GoodsInfo.EnumGoodsType, ornamentsType.Value)).ToArray(); foreach (PlayGoods _playGoods in ornaments) { _playGoods.GoodsLocation = GoodsLocation.Package; } } } //如果是武器(这里是单手武器,双手武器以及副手在上面已经判断过了 ) else if (GoodsStaticTools.IsChildGoodsNode(enumGoodsType, EnumGoodsType.Arms)) { //需要卸载所有的右手装备 PlayGoods[] rightHandedWeapons = playerState.PlayerAllGoods.Where( temp => temp.GoodsLocation == GoodsLocation.Wearing && temp.leftRightArms != null && temp.leftRightArms.Value == true).ToArray(); foreach (PlayGoods _playGoods in rightHandedWeapons) { _playGoods.leftRightArms = null; _playGoods.GoodsLocation = GoodsLocation.Package; } playGoods.leftRightArms = true; } //如果是其他装备(防具等) else { EnumGoodsType?armorType = GoodsStaticTools.GetParentGoodsType(playGoods.GoodsInfo.EnumGoodsType, 2); //从基础的防具类型向上跳到防具的大类(头盔大类 盔甲类 鞋子类) if (armorType != null && GoodsStaticTools.IsChildGoodsNode(armorType.Value, EnumGoodsType.Equipment)) { PlayGoods[] ammors = playerState.PlayerAllGoods.Where( temp => temp.GoodsLocation == GoodsLocation.Wearing && GoodsStaticTools.IsChildGoodsNode(temp.GoodsInfo.EnumGoodsType, armorType.Value)).ToArray(); foreach (PlayGoods _playGoods in ammors) { _playGoods.GoodsLocation = GoodsLocation.Package; } } } playGoods.GoodsLocation = GoodsLocation.Wearing; iPlayerStateRun.EquipmentChanged = true; } else if (GoodsStaticTools.IsChildGoodsNode(enumGoodsType, EnumGoodsType.Elixir))//如果是炼金药剂类则直接服用 { iPlayerStateRun.EatMedicine(playGoods.ID); } else if (GoodsStaticTools.IsChildGoodsNode(enumGoodsType, EnumGoodsType.Item)) //如果是道具 { if (enumGoodsType == EnumGoodsType.MagicScroll) //此处的魔法卷轴有一个任务的特殊检测 { INowTaskState iNowTaskState = GameState.Instance.GetEntity <INowTaskState>(); iNowTaskState.CheckNowTask(EnumCheckTaskType.Special, (int)TaskMap.Enums.EnumTaskSpecialCheck.SummonsScrollMagic); } Debug.Log("道具功能暂未实现"); } } }
private void CheckTask(INowTaskState iNowTaskState, string fieldName) { CheckTask(iNowTaskState); }
/// <summary> /// 当隐藏时处理 /// </summary> private void OnDisable() { UIManager.Instance.KeyUpHandle -= Instance_KeyUpHandle; if (nowKeySettingLattice) { nowKeySettingLattice.LostForcus(); } //保存状态 UIFocus[] uiKeySettingLatticeArray = keySettingFocusPath.UIFocuesArray; foreach (UIFocus item in uiKeySettingLatticeArray) { if (!item) { continue; } UIFocusKeySettingLattice uiKeySettingLattice = item as UIFocusKeySettingLattice; int inputKey = uiKeySettingLattice.GetKeySettingInput();//输入的按键值 if (uiKeySettingLattice) { //KeyContactStruct[] keyContactStructs = keyContactData.GetKeyContactStruct(inputKey); KeyContactStruct newTarget = new KeyContactStruct(); newTarget.id = uiKeySettingLattice.id; newTarget.keyContactType = uiKeySettingLattice.keyLatticeType; //if (keyContactStructs.Length > 0) //{ // newTarget = keyContactStructs[0]; //} //else //{ //设置对象的名字 switch (newTarget.keyContactType) { case EnumKeyContactType.None: newTarget.name = "None"; break; case EnumKeyContactType.Skill: EnumSkillType[] skillTypes = SkillCombineStaticTools.GetCombineSkills(newTarget.id); newTarget.name = SkillCombineStaticTools.GetCombineSkillsName(skillTypes); //如果是火球术 if (newTarget.id == SkillCombineStaticTools.GetCombineSkillKey(new EnumSkillType[] { EnumSkillType.FS01, EnumSkillType.YSX01 })) { //给任务系统填入状态 INowTaskState iNowTaskState = GameState.Instance.GetEntity <INowTaskState>(); iNowTaskState.CheckNowTask(EnumCheckTaskType.Special, (int)TaskMap.Enums.EnumTaskSpecialCheck.SetFireSkillToLattice); } break; case EnumKeyContactType.Prap: PlayGoods playGoods = playerState.PlayerAllGoods.FirstOrDefault(temp => temp.ID == newTarget.id); newTarget.name = playGoods.GoodsInfo.GoodsName; break; case EnumKeyContactType.Action: newTarget.name = "暂无功能"; break; } //} keyContactData.SetKeyContactStruct(inputKey, newTarget); } } }
private void INowTaskStateChanged(INowTaskState iNowTaskState, string fieldName) { }