Example #1
0
 public void RefreshBtnState()
 {
     foreach (var btn in NewFuntcionBtn)
     {
         if (GuideTrigger.IsFunctionOpen(btn.name))
         {
             btn.LockBtn(false);
         }
         else
         {
             btn.LockBtn(true);
         }
     }
 }
Example #2
0
 public bool IsNoticeMainDown()
 {
     foreach (var btn in NewFuntcionBtn)
     {
         if (GuideTrigger.IsFunctionOpen(btn.name))
         {
             if (btn.name == "BtnEquip" && (PlayerDataManager.Instance.WeakNoticeData.AppendNotice))
             {
                 return(true);
             }
             if (btn.name == "BtnHnadBook" && (PlayerDataManager.Instance.NoticeData.HandBookTotal))
             {
                 return(true);
             }
             if (btn.name == "BtnElf" &&
                 (PlayerDataManager.Instance.NoticeData.ElfDraw ||
                  PlayerDataManager.Instance.WeakNoticeData.ElfTotal))
             {
                 return(true);
             }
             if (btn.name == "BtnSkill" &&
                 (PlayerDataManager.Instance.NoticeData.SkillTotal ||
                  PlayerDataManager.Instance.WeakNoticeData.SkillTotal))
             {
                 return(true);
             }
             if (btn.name == "BtnWing" && (PlayerDataManager.Instance.NoticeData.WingAdvance ||
                                           PlayerDataManager.Instance.WeakNoticeData.WingTraining))
             {
                 return(true);
             }
             if (btn.name == "BtnSailingHarbor" && (PlayerDataManager.Instance.NoticeData.SailingNotice))
             {
                 return(true);
             }
             if (btn.name == "BtnAchievement" && (PlayerDataManager.Instance.NoticeData.HasAchievement))
             {
                 return(true);
             }
             if (btn.name == "BtnBattleUnion" && (PlayerDataManager.Instance.NoticeData.BattleList))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Example #3
0
    public bool SelectTarget(GameObject gameObject, int skill = -1)
    {
        //null鍒ゆ柇
        if (null == gameObject)
        {
            return(false);
        }

        //鑾峰緱涓昏鑷繁
        var myself = ObjManager.Instance.MyPlayer;

        if (null == myself)
        {
            return(false);
        }

        //鐩爣寰楁槸涓猳bj
        var obj = gameObject.GetComponent <ObjBase>();

        if (null == obj)
        {
            return(false);
        }

        if (skill == -1)
        {
            TargetCharacter(obj);
        }
        //鍋滄褰撳墠鐨勬寚浠?
        //Executer.Stop();

        //璁$畻鑷繁璺濈鐩爣鐨勮窛绂?
        var distance = Vector3.Distance(obj.Position, myself.Position);

        //榛樿鎶€鑳?
        var skillId = skill;

        if (skillId == -1)
        {
            skillId = PlayerDataManager.Instance.GetNormalSkill();
        }

        if (obj.IsCharacter() && myself.IsMyEnemy(obj as ObjCharacter))
        {
            if (obj.GetObjType() == OBJ.TYPE.NPC || obj.GetObjType() == OBJ.TYPE.RETINUE)
            {
//濡傛灉鏄痭pc
                var npc = obj as ObjNPC;
                if (npc == null)
                {
                    return(false);
                }
                if (!npc.CanBeInteractive())
                {
                    return(false);
                }
            }
            var character = obj as ObjCharacter;

            if (character.Dead)
            {
                return(false);
            }

            //瀵瑰叾閲婃斁鎶€鑳?
            var data = Table.GetSkill(skillId);
            //鐩爣绫诲瀷
            var targetType = (SkillTargetType)ObjMyPlayer.GetSkillData_Data(data, eModifySkillType.TargetType);

            //涓嶉渶瑕佺洰鏍囩殑鎶€鑳?
            if (targetType == SkillTargetType.SELF ||
                targetType == SkillTargetType.CIRCLE ||
                targetType == SkillTargetType.SECTOR ||
                targetType == SkillTargetType.RECT)
            {
                //浣跨敤鎶€鑳?
                return(UseSkill(myself.GetObjId(), skillId, character.GetObjId()));
            } //闇€瑕佺洰鏍囩殑鎶€鑳?
            if (targetType == SkillTargetType.SINGLE ||
                targetType == SkillTargetType.TARGET_CIRCLE ||
                targetType == SkillTargetType.TARGET_RECT ||
                targetType == SkillTargetType.TARGET_SECTOR)
            {
                var maxSkillDistance = GetSkillReleaseDistance(data);
                if (maxSkillDistance - 0.5 < 0.0f)
                {
                    maxSkillDistance = 0.5f;
                }

                if (distance > maxSkillDistance - 0.5)
                {
//璺濈涓嶅
                    var offset = maxSkillDistance - 1.0f;
                    if (offset < 0.0f)
                    {
                        offset = 0.1f;
                    }
                    Executer.PushCommand(new MoveCommand(myself, character.Position, offset));
                    Executer.PushCommand(new AttackCommand(myself.GetObjId(), skillId, character.GetObjId()));
                }
                else
                {
                    TargetObj = character;
                    PlayerDataManager.Instance.SetSelectTargetData(TargetObj, 3);
                    ObjManager.Instance.MyPlayer.FaceTo(character.Position);
                    return(UseSkill(myself.GetObjId(), skillId, character.GetObjId()));
                }
            }
            else
            {
                Logger.Error("Unknow skill target type = {0}", targetType);
            }
        }
        else if (obj.GetObjType() == OBJ.TYPE.NPC)
        {
            var npc = obj as ObjNPC;

            if (!npc.CanBeInteractive())
            {
                return(false);
            }
            if (npc.TableNPC.NpcType == (int)eNpcType.PickUpNpc)
            {
                if (distance > GameSetting.Instance.MaxDistance_NPC)
                {
                    var command = new MoveCommand(myself, npc.Position, GameSetting.Instance.MaxDistance_NPC);
                    Executer.PushCommand(command);
                    return(false);
                }
                else
                {
                    {
                        if (!IsInit)
                        {
                            Table.ForeachWarFlag(tb =>
                            {
                                WarFlagDic.Add(tb.Id, tb.FlagModel);
                                return(true);
                            });
                            Table.ForeachLode(tb =>
                            {
                                if (tb.Id < 100000)
                                {
                                    LodeDic.Add(tb.Id, tb.NpcId);
                                }
                                else if (tb.Id >= 100000 && tb.Id <= 100020)//策划指定墓碑使用此区间
                                {
                                    MonumentDic.Add(tb.Id, tb.NpcId);
                                }
                                return(true);
                            });
                            IsInit = true;
                        }
                        var npcId = npc.TableNPC.Id;
                        if (WarFlagDic.ContainsValue(npcId))
                        {
                            //战旗
                            PlayerDataManager.Instance.HoldLode(npcId);
                            return(false);
                        }
                        else if (LodeDic.ContainsValue(npcId))
                        {
                            //采矿
                            PlayerDataManager.Instance.CollectLode(npcId);
                            return(false);
                        }
                        else if (MonumentDic.ContainsValue(npcId))
                        {
                            //祭拜
                            PlayerDataManager.Instance.WorshipMonument(npcId);
                            return(false);
                        }
                    }
                    EventDispatcher.Instance.DispatchEvent(new PickUpNpc_Event(npc.GetDataId(), npc.GetObjId()));
                    return(false);
                }
            }

            var npcDataId = npc.GetDataId();
            if (npcDataId >= 108 && npcDataId <= 110)//判断是否是排行NPC
            {
                EventDispatcher.Instance.DispatchEvent(new OnRankNpcClick_Event(npcDataId));
            }

            myself.StopMove();
            if (distance <= GameSetting.Instance.MaxDistance_NPC)
            {
                if (MissionManager.Instance.OpenMissionByNpcId(npc.GetDataId(), npc.GetObjId()))
                {
                    npc.DoDialogue();
                    //TODO
                    if (myself.IsAutoFight())
                    {
                        myself.LeaveAutoCombat();
                    }
                }
            }
            else
            {
                var command = new MoveCommand(myself, npc.Position, GameSetting.Instance.MaxDistance_NPC);
                Executer.PushCommand(command);
                var command1 = new FuncCommand(() =>
                {
                    if (MissionManager.Instance.OpenMissionByNpcId(npc.GetDataId(), npc.GetObjId()))
                    {
                        npc.DoDialogue();
                        //TODO
                        if (myself.IsAutoFight())
                        {
                            myself.LeaveAutoCombat();
                        }
                    }
                });
                Executer.PushCommand(command1);
            }
        }
        else if (obj.GetObjType() == OBJ.TYPE.DROPITEM)
        {
//濡傛灉鏄帀钀界墿鍝?
            var dropItem = obj as ObjDropItem;
            myself.StopMove();
            var dis = GameSetting.Instance.MaxDistance_DropItem;

            if (dropItem.mTableData != null && dropItem.mTableData.Type == 300)
            {
                dis = GameUtils.AutoPickUpBuffDistance;
            }

            if (distance <= dis)
            {
                dropItem.Pickup();
            }
            else
            {
                var command = new MoveCommand(myself, dropItem.Position, dis);
                Executer.PushCommand(command);
                var command1 = new FuncCommand(() =>
                {
                    if (null != dropItem)
                    {
                        dropItem.Pickup();
                    }
                });
                Executer.PushCommand(command1);
            }
        }
        else if (obj.GetObjType() == OBJ.TYPE.FAKE_CHARACTER)
        {
            if (((ObjFakeCharacter)obj).iType == (int)eFakeCharacterTypeDefine.MieShiFakeCharacterType)
            {
                EventDispatcher.Instance.DispatchEvent(new ApplyPortraitAward_Event(obj.GetDataId()));
            }
            else
            {
                if (((ObjFakeCharacter)obj).iType == (int)OBJ.TYPE.FAKE_FIGHTLEADER)
                {
                    if (GuideTrigger.IsFunctionOpen("BtnRank"))
                    {
                        var e = new Show_UI_Event(UIConfig.RankUI, new RankArguments {
                            RankId = obj.GetObjId()
                        });
                        EventDispatcher.Instance.DispatchEvent(e);
                    }
                    else
                    {
                        EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard(1736));
                    }
                }
                else
                {
                    EventDispatcher.Instance.DispatchEvent(new Show_UI_Event(UIConfig.WorshipFrame));
                }
            }
        }
        return(false);
    }