Exemplo n.º 1
0
    public void CastSkill(string token)
    {
        int skillId = -1;

        if (string.IsNullOrEmpty(token))
        {
            if (!GuideModel.singleton.bIsGuideAllComp)
            {
                //再次尝试
                GuideModel.singleton.NowTaskId = 6007;
                EventDispatch.Broadcast(Events.DlgGuideExecuteNextTask);
            }
        }
        else
        {
            //出现口令
            skillId = SkillManager.singleton.MatchSkill(token);
            if (skillId == -1)
            {
                Debug.Log("匹配不到技能");
                this.ShowToken(token);
                if (!GuideModel.singleton.bIsGuideAllComp)
                {
                    //再次尝试
                    GuideModel.singleton.NowTaskId = 6007;
                    EventDispatch.Broadcast(Events.DlgGuideExecuteNextTask);
                }
            }
        }
        GameSkillBase skill = SkillManager.singleton.GetSkill(skillId);

        if (skill != null)
        {
            this.ShowToken(skill.skillConfig.skillName);
            skill.Enter(this.entity, true);
            if (!GuideModel.singleton.bIsGuideAllComp)
            {
                TimerManager.AddTimer(4000, 0, () =>
                {
                    GuideModel.singleton.NowTaskId = 6008;
                    EventDispatch.Broadcast(Events.DlgGuideExecuteNextTask);
                });
            }
        }
        if (this.ShowTokenTimerId != uint.MinValue)
        {
            TimerManager.DelTimer(this.ShowTokenTimerId);
            this.ShowTokenTimerId = TimerManager.AddTimer(4000, 0, () =>
            {
                this.ShowToken("", false);
            });
        }
        else
        {
            this.ShowTokenTimerId = TimerManager.AddTimer(4000, 0, () =>
            {
                this.ShowToken("", false);
            });
        }
    }
Exemplo n.º 2
0
    public void OnClickButtonSpeakTest()
    {
        GameSkillBase skill = SkillManager.singleton.GetSkill(this.selectSkillId);

        //等音频播放结束后,然后角色播放动作
        if (skill != null)
        {
            this.ShowSpeakButton(false);
            //出现口令
            this.ShowToken(skill.skillConfig.skillRealToken);
            skill.Enter(this.entity, true);
            TimerManager.AddTimer(4000, 0, () =>
            {
                this.ShowToken("", false);
                this.ShowSpeakButton(true);
                if (!GuideModel.singleton.bIsGuideAllComp && GuideModel.singleton.bIsSelfSpeaked == false)
                {
                    //然后开始guide进入自己说
                    GuideModel.singleton.NowTaskId      = 6005;
                    GuideModel.singleton.bIsSelfSpeaked = true;
                    EventDispatch.Broadcast(Events.DlgGuideExecuteNextTask);
                }
            });
        }
    }
Exemplo n.º 3
0
    public bool LockSkill(int skillId)
    {
        GameSkillBase skill = SkillManager.singleton.GetSkill(skillId);

        if (skill != null)
        {
            skill.bLocked = true;
            this.lockedSkills.Add(skill);
            if (!PlayerPrefs.HasKey(CommonDefineBase.LockedSkills))
            {
                PlayerPrefs.SetString(CommonDefineBase.LockedSkills, skillId.ToString());
            }
            else
            {
                string content = PlayerPrefs.GetString(CommonDefineBase.LockedSkills);
                content += "," + skillId;
                PlayerPrefs.SetString(CommonDefineBase.LockedSkills, content);
            }
            return(true);
        }
        else
        {
            return(false);
        }
    }
Exemplo n.º 4
0
 public void Control(int skillId, bool allMonster)
 {
     if (skills.ContainsKey(skillId))
     {
         GameSkillBase skill = this.skills[skillId];
         int           level = skill.level;
         if (level == 0)
         {
             Debug.LogError("level == 0");
             return;
         }
         float controllValue = skill.skillConfig.param[level + 1].param;
         if (controllValue <= 0)
         {
             Debug.LogError("减速==0");
             return;
         }
         if (allMonster)
         {
             List <EntityParent> entitys = PlayerManager.singleton.allVisiableMonster;
             foreach (var moster in entitys)
             {
                 moster.ApplyControl(controllValue);
             }
         }
     }
 }
Exemplo n.º 5
0
 public void SlowDown(int skillId, bool allMonster, float duration)
 {
     if (skills.ContainsKey(skillId))
     {
         GameSkillBase skill = this.skills[skillId];
         int           level = skill.level;
         if (level == 0)
         {
             Debug.LogError("level == 0");
             return;
         }
         float slowValue = skill.skillConfig.param[level + 2].param;
         if (slowValue <= 0)
         {
             Debug.LogError("减速==0");
             return;
         }
         if (allMonster)
         {
             List <EntityParent> entitys = new List <EntityParent>(PlayerManager.singleton.allVisiableMonster);
             foreach (var moster in entitys)
             {
                 moster.ApplySlowDown((int)slowValue, duration);
             }
         }
     }
 }
Exemplo n.º 6
0
    public void UpgradeSkill(int skillId, GameObject upGrade)
    {
        GameSkillBase skill = SkillManager.singleton.GetSkill(skillId);

        if (skill != null)
        {
            int level = skill.level;
            if (level <= skill.skillConfig.upgradeGold.Count)
            {
                skill.level = level + 1;
                //播放升级的动画?减少金币
                EventDispatch.Broadcast(Events.DlgFlyTextShow);
                EventDispatch.Broadcast <string>(Events.DlgAddSingleSystemInfo, "成功升级该技能");
                int upGradeGold = skill.skillConfig.upgradeGold[level];
                UserPrefsBase.singleton.AddMoney(-upGradeGold);
                if (level + 1 >= skill.skillConfig.upgradeGold.Count)
                {
                    //已经是最打等级
                    //隐藏
                    upGrade.SetActive(false);
                }
            }
            else
            {
                Debug.LogError("已经是最打等级");
            }
        }
    }
 public virtual void Enter(Skill skill, EntityParent theOwner, GameSkillBase gameskill)
 {
     this.skillConfig = skill;
     this.theOwner    = theOwner;
     this.skill       = gameskill;
     this.CreateEntity();
 }
Exemplo n.º 8
0
 public void OnPointerDown(PointerEventData eventData)
 {
     if (!UnityMonoDriver.s_instance.ReleaseMode)
     {
         GameSkillBase skill = SkillManager.singleton.GetSkill(this.skillId);
         PlayerManager.singleton.MySelf.CastSkill(skill.skillConfig.skillToken);
     }
 }
Exemplo n.º 9
0
    public void LoadSkill()
    {
        string content = (Resources.Load("skills") as TextAsset).text;

        if (string.IsNullOrEmpty(content))
        {
            Debug.LogError("SkillContent == null");
            return;
        }
        SkillConfig config = JsonConvert.DeserializeObject <SkillConfig>(content);

        foreach (var skill in config.skills)
        {
            GameSkillBase gameSkill = this.MakeSkill(skill);
            if (skill == null)
            {
                Debug.LogError("skill == null");
                continue;
            }
            gameSkill.Init(skill);
            this.skills.Add(skill.skillId, gameSkill);
            this.skillStrings.Add(skill.skillToken, gameSkill);
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < skill.skillToken.Length; i++)
            {
                sb.Append(CommonDefineBase.RegexFormat);
                sb.Append(skill.skillToken[i]);
                if (i == skill.skillToken.Length - 1)
                {
                    sb.Append(CommonDefineBase.RegexFormat);
                }
            }
            Regex reg = new Regex(sb.ToString());
            this.skillRegexs.Add(skill.skillId, reg);
        }
        if (PlayerPrefs.HasKey(CommonDefineBase.LockedSkills))
        {
            if (!GuideModel.singleton.bIsGuideAllComp)
            {
                PlayerPrefs.DeleteKey(CommonDefineBase.LockedSkills);
                return;
            }
            string[] lockedSkillcontent = PlayerPrefs.GetString(CommonDefineBase.LockedSkills).Split(',');
            foreach (var locked in lockedSkillcontent)
            {
                GameSkillBase skill   = null;
                int           skillId = int.Parse(locked);
                if (this.skills.TryGetValue(skillId, out skill))
                {
                    skill.bLocked = true;
                    this.lockedSkills.Add(skill);
                }
            }
        }
    }
 // 状态处理
 public void Process(EntityParent theOwner, params object[] args)
 {
     skill = (GameSkillBase)args[0];
     if (SkillManager.singleton.IsSkillInRunning(skill.skillConfig.skillId))
     {
         Debug.Log("runing:" + skill.skillConfig.skillName);
         return;
     }
     if (skill != null && skill.skillConfig != null)
     {
         skill.Enter(theOwner);
         this.curSkillId = skill.skillConfig.skillId;
     }
 }
Exemplo n.º 11
0
    private void RefreshSkillItem(int itemId)
    {
        XUIListItem   item  = this.m_List_Skills.GetItemById(itemId);
        GameSkillBase skill = SkillManager.singleton.GetSkill(itemId);

        if (item != null && skill != null)
        {
            bool hasLocked = skill.bLocked;
            item.GetChild("sp_lock").gameObject.SetActive(!hasLocked);
            item.toggle.interactable = hasLocked;
            string btName = hasLocked ? "学习" : "解锁";
            item.SetText("bt_click/Text", btName);
        }
    }
Exemplo n.º 12
0
 public void SetCD(int skillId)
 {
     if (skillId > 0 && this.skills.Count > 0)
     {
         SkillView     skillItem = this.skills[skillId];
         GameSkillBase skill     = SkillManager.singleton.GetSkill(skillId);
         float         cd        = skill.skillConfig.cds[skill.level - 1].cd;
         if (skillItem != null)
         {
             skillItem.SetActiveMask(true);
             skillItem.SetFillAmount(1f);
             skillItem.StartTweenCD(cd);
             skillItem.StartCDTextNumTimer(cd);
         }
     }
 }
Exemplo n.º 13
0
 public bool IsSkillInRunning(int skillId)
 {
     foreach (var skill in this.runningSkills)
     {
         if (skill.skillConfig.skillId == skillId)
         {
             return(true);
         }
         GameSkillBase skill1 = this.GetSkill(skillId);
         if (skill.skillConfig.HasActor == false)
         {
             return(true);
         }
     }
     return(false);
 }
    public void CastSkill(string skillToken)
    {
        if (string.IsNullOrEmpty(skillToken))
        {
            return;
        }
        int skillId = SkillManager.singleton.MatchSkill(skillToken);

        if (skillId == -1)
        {
            Debug.Log("匹配不到技能");
            return;
        }
        GameSkillBase skill = SkillManager.singleton.GetSkill(skillId);

        if (skill != null)
        {
            this.ChangeMotionState(MotionState.ReleaseSkill, skill);
        }
    }
Exemplo n.º 15
0
 public override void Enter(Skill skill, EntityParent theOwner, GameSkillBase gameskill)
 {
     base.Enter(skill, theOwner, gameskill);
     //实例化箭头
     if (ResourcePoolManager.singleton.dicEffectPool.ContainsKey(CommonDefineBase.TargetEffectPath))
     {
         Transform  prefab     = ResourcePoolManager.singleton.dicEffectPool[CommonDefineBase.TargetEffectPath];
         GameObject gameobject = PoolManager.Pools[PoolManager.EffectPoolName].Spawn(prefab).gameObject;
         if (gameSkill.Test)
         {
             gameobject.transform.position = Vector3.zero;
             gameobject.layer = LayerMask.NameToLayer("UI");
         }
         else
         {
             gameobject.transform.position = new Vector3(12, 8, 0);
             gameobject.layer = LayerMask.NameToLayer("Default");
         }
         TargetBehaviour = gameobject.GetComponent <TargetBehaviour>();
         TargetBehaviour.text.gameObject.SetActive(true);
         TargetBehaviour.skill = gameskill as SelectDirSkill;
     }
     if (ResourcePoolManager.singleton.dicEffectPool.ContainsKey(CommonDefineBase.LineEffectPath))
     {
         Transform  prefab     = ResourcePoolManager.singleton.dicEffectPool[CommonDefineBase.LineEffectPath];
         GameObject gameobject = PoolManager.Pools[PoolManager.EffectPoolName].Spawn(prefab).gameObject;
         if (gameSkill.Test)
         {
             gameobject.layer = LayerMask.NameToLayer("UI");
             Vector3 pos = gameobject.transform.position;
             pos.z = 24;
             gameobject.transform.position = pos;
         }
         else
         {
             gameobject.layer = LayerMask.NameToLayer("Default");
         }
         line = gameobject.GetComponent <Line>();
         line.Initialise((theOwner.bindNodeTable[CommonDefineBase.BindQiangkou] as Transform).position, TargetBehaviour.transform.position, 0.05f, Color.red);;
     }
 }
Exemplo n.º 16
0
    public void EnterLearn(int skillId, bool bSelect = true)
    {
        this.SKillView.SetActive(false);
        this.MySelf.SetActive(true);
        this.parse = TestParse.SkillSelectLearn;
        GameSkillBase skill = SkillManager.singleton.GetSkill(skillId);

        if (skill != null)
        {
            this.m_Iamge_SkillIcon.sprite = WWWResourceManager.Instance.LoadSpriteFormAtla("common1.ab", skill.skillConfig.skillName);
            this.m_Text_SkillInfo.text    = skill.skillConfig.skillInfo + "\n <color=red>口令:" + skill.skillConfig.skillRealToken + "</color>";
            this.m_Text_SkillName.text    = skill.skillConfig.skillName;
            this.SkillLearn.SetActive(true);
        }
        if (!GuideModel.singleton.bIsGuideAllComp && bSelect == false)
        {
            GuideModel.singleton.NowTaskId = 6004;
            EventDispatch.Broadcast(Events.DlgGuideExecuteNextTask);
        }
        else if (GuideModel.singleton.bIsGuideAllComp)
        {
            this.m_Button_Back.gameObject.SetActive(true);
        }
    }
 // 离开状态
 public void Exit(EntityParent theOwner, params object[] args)
 {
     skill           = null;
     this.curSkillId = 0;
 }