public void SetUse(SkillOperateData skillOperateData)
 {
     if (useEffect != null && obj == null)
     {
         useEffect.Play(transform.position, data.skillConfig.operate);
     }
 }
Пример #2
0
        void Right(SkillOperateData operateData)
        {
            HeroSkillClip heroSkillClip;

            if (rightIndex < rightList.Count)
            {
                heroSkillClip = rightList[rightIndex];
            }
            else
            {
                GameObject go = GameObject.Instantiate(prefab.gameObject);
                go.transform.SetParent(prefab.transform.parent);
                go.transform.localScale = Vector3.one;
                heroSkillClip           = go.GetComponent <HeroSkillClip>();
                rightList.Add(heroSkillClip);
            }

            heroSkillClip.gameObject.name      = "HeroSkillClip-right-" + rightIndex;
            heroSkillClip.heroSkillClipManager = this;
            heroSkillClip.SetData(operateData);
            heroSkillClip.isRight = true;
            heroSkillClip.index   = rightIndex;
            heroSkillClip.SetDirection();
            rightIndex++;
            rightCount++;
            heroSkillClip.Play();
        }
Пример #3
0
 public void SkillUse(SkillOperateData operateData)
 {
     if (sSkillUse != null)
     {
         sSkillUse(operateData);
     }
 }
Пример #4
0
        public void ShowHelp(SkillOperateData skillData)
        {
            if (skillData.relation == RelationType.Own)
            {
                skillData.heroData.legionData.CancelSkillOperator(skillData);
//				skillData.operateState = SkillOperateState.Selected;

                OperateAction action = null;

                switch (skillData.skillConfig.operate)
                {
                case SkillOperateType.SelectUnit:
                    action = new SelectUnitAction();
                    break;

                case SkillOperateType.SelectCircle:
//					action = new SelectCircleAction();
                    break;

                case SkillOperateType.SelectDirection:
                    action = new SelectDirectionAction();
                    break;
                }


                if (action != null)
                {
                    action.skillUse  = this;
                    action.skillData = skillData;
                    action.Enter();
                }
            }
        }
Пример #5
0
        void OnSkillProduce(SkillOperateData skillOperateData)
        {
            Debug.Log("skillOperateData.grooveIndex=" + skillOperateData.grooveIndex);
            SkillOperateController skillController = skillControllers[skillOperateData.grooveIndex];

            skillController.SetData(skillOperateData);
        }
Пример #6
0
        public void MShow(SkillOperateData skillData, RectTransform target)
        {
            this.skillData = skillData;
            gameObject.SetActive(true);


            RectTransform rectTransform = GetComponent <RectTransform>();

//			float rate  = Mathf.Min(Screen.height / 640F, 1.3F);
//			rate  = Mathf.Max(rate, 0.7F);
//			transform.localScale = new Vector3(rate, rate, rate);


//			Vector3 screenPos = camera.WorldToScreenPoint(target.position);

            Vector3 screenPos = target.position;

            screenPos.y += target.rect.height * target.lossyScale.y;
            if (screenPos.x < rectTransform.rect.width * rectTransform.lossyScale.x * 0.5f)
            {
                screenPos.x = rectTransform.rect.width * rectTransform.lossyScale.x * 0.5f;
            }

            if (screenPos.x > Screen.width - rectTransform.rect.width * rectTransform.lossyScale.x * 0.5f)
            {
                screenPos.x = Screen.width - rectTransform.rect.width * rectTransform.lossyScale.x * 0.5f;
            }

//			Vector3 position = target.position;
//			position.y += target.rect.height * target.lossyScale.y * 0.5F;

            rectTransform.position = screenPos;
        }
Пример #7
0
 public void SkillProduceOwn(SkillOperateData operateData)
 {
     if (sSkillProduceOwn != null)
     {
         sSkillProduceOwn(operateData);
     }
 }
Пример #8
0
        bool AIUse(SkillOperateData skillData)
        {
            bool isUse = War.skillWarManager.checkSkillAIType(skillData.skillId, legionData.legionId);

            if (isUse == false)
            {
                return(false);
            }
            switch (skillData.skillConfig.operate)
            {
            case SkillOperateType.Immediately:
            case SkillOperateType.Passive:

                return(true);

                break;

            case SkillOperateType.SelectUnit:
                return(AIUse_SelectUnit(skillData));

                break;

            case SkillOperateType.SelectCircle:
                return(AIUse_SelectCircle(skillData));

                break;
            }

            return(false);
        }
Пример #9
0
 public static void Hide(SkillOperateData skillOperateData)
 {
     if (lastSkill == skillOperateData)
     {
         lastSkill = null;
         instance.hide();
     }
 }
Пример #10
0
		IEnumerator SkillCD(SkillOperateData skillOperateData)
		{
			yield return new WaitForSeconds(skillOperateData.skillConfig.cd);

			// 添加到生产列表
			legionData.enableProduceSkillUids.Add(skillOperateData.uid);
			// 检测是否需要设置生成技能
			CheckProduceSkill();
		}
Пример #11
0
        public void SetData(SkillOperateData data)
        {
            this.data = data;

            skillTypeIconImage.sprite = War.icons.GetSkillSelectUnitIcon(data.selectUnitIconType);
            heroNameText.text         = string.IsNullOrEmpty(data.heroName) ? "无名英雄" : data.heroName;
//			heroNameText.color = data.heroColor;
            skillNameText.text = data.skillConfig.name + "<color=#D6E8C8FF><size=43> " + data.skillLevel + "级</size></color>";
        }
Пример #12
0
        public void SetData(SkillOperateData data)
        {
            this.data = data;
            data.LoadIcon(OnLoadSkillIcon);
            data.LoadVSHeadIcon(OnLoadHeroIcon);

//			nameText.text =data.skillConfig.skillId + data.skillConfig.name;
            nameText.text = "";
        }
Пример #13
0
        public SkillOperateData GetSkillOperateData(int skillUID)
        {
            SkillOperateData data = null;

            if (skillOperateDataForUID.TryGetValue(skillUID, out data))
            {
                return(data);
            }
            return(null);
        }
Пример #14
0
 /** 取消该势力(玩家)所有技能操作 */
 public void CancelSkillOperator(SkillOperateData current = null)
 {
     foreach (KeyValuePair <int, SkillOperateData> kvp in skillDatas)
     {
         if (current != kvp.Value)
         {
             kvp.Value.CancelOperator();
         }
     }
 }
Пример #15
0
 public void OnUse(SkillOperateData operateData)
 {
     if (operateData.relation == RelationType.Enemy)
     {
         Right(operateData);
     }
     else
     {
         Left(operateData);
     }
 }
Пример #16
0
        public void ExeSkill(int skillId)
        {
            SkillOperateData skillOperateData = legionData.GetSkillDataBySkillId(skillId);

            if (skillOperateData != null)
            {
                if (AIUse(skillOperateData))
                {
                    skillOperateData.OnUse();
                }
            }
        }
        public void SetData(SkillOperateData data)
        {
            uiCamera = Coo.uiCamera;

            this.data = data;
            data.receiveList.Clear();
            skillButton.SetData(data);
            skillInfoNode.SetData(data);
            if (useEffect != null)
            {
                useEffect.SetData(data);
            }



            if (data.skillConfig.skillType == SkillType.Build_Replace)
            {
                BuildConfig buildConfig = War.model.GetBuildConfig(data.skillConfig.buildId);
                Debug.Log("data.skillId=" + data.skillId + "  data.skillConfig.buildId=" + data.skillConfig.buildId);
                string file = buildConfig.GetLevelConfig(1).avatarConfig.Model;
                Debug.Log(file);
                GameObject prefab = WarRes.GetPrefab(file);
                obj = GameObject.Instantiate(prefab);
                obj.SetActive(false);
                obj.GetComponent <SpriteRenderer>().color = new Color(0.8f, 0.8f, 0.8f, 0.8f);
                objDestory = true;
            }
            else
            {
                switch (data.skillConfig.operate)
                {
                case SkillOperateType.SelectCircle:
                    obj = GameObject.Instantiate(War.skillUse.selectCircleView.gameObject);
                    obj.SetActive(false);
                    SkillOperateSelectCircleView skillOperateSelectCircleView = obj.GetComponent <SkillOperateSelectCircleView> ();
                    skillOperateSelectCircleView.Radius   = data.skillConfig.radius;
                    skillOperateSelectCircleView.Relation = data.skillConfig.relation;
                    objDestory = true;
                    break;
                }
            }

            selectUnitMaterialType = data.skillConfig.relation.REnemy() ? WarMaterialsType.operateSelect_Enemy : WarMaterialsType.operateSelect_Own;

            if (this.data != null)
            {
                rectTransform.anchoredPosition = new Vector2(-180, 56);
                MoveToGroove();

                this.data.sSetUse += SetUse;
            }
        }
Пример #18
0
        IEnumerator DelayUse(SkillOperateData operateData)
        {
            yield return(new WaitForSeconds(delayUseTime));

//			if(operateData.skillConfig.isUseBuildProcessor)
//			{
//				OnUseBuild(operateData);
//			}
//			else
//			{
            War.skillWarManager.DealSkill(operateData);
//			}
        }
Пример #19
0
        void Execute()
        {
            for (int i = 0; i < legionData.barSkillUids.Count; i++)
            {
                int skillUid = legionData.barSkillUids[i];
                SkillOperateData skillOperateData = legionData.skillDatas[skillUid];
                if (AIUse(skillOperateData))
                {
                    skillOperateData.OnUse();

                    return;
                }
            }
        }
Пример #20
0
        void Init()
        {
            if (legionData.initUseSkillId > 0)
            {
                SkillOperateData skillOperateData = legionData.GetSkillDataBySkillId(legionData.initUseSkillId);
                skillOperateData.receiveList.Clear();
                skillOperateData.receiveList.Add(War.scene.GetBuild(legionData.initUseSkillBuildId));
                skillOperateData.OnUse();

                if (legionData.enableProduceSkillUids.IndexOf(skillOperateData.uid) != -1)
                {
                    legionData.enableProduceSkillUids.Remove(skillOperateData.uid);
                }
            }
        }
Пример #21
0
        void Update()
        {
            if (_skillData != skillData)
            {
                _skillData = skillData;

                if (_skillData != null)
                {
                    skillData.LoadIcon(OnLoadIcon);

                    skillName.text        = skillData.skillConfig.name;
                    skillDescription.text = skillData.skillConfig.description;
                }
            }
        }
Пример #22
0
		/** 事件--使用技能 */
		IEnumerator DelayOnSkillUse(SkillOperateData skillOperateData)
		{
			yield return new WaitForSeconds(0.5f);

			if(skillOperateData.heroData.legionData == legionData)
			{
				skillOperateData.useNum ++;

				int skillUid = skillOperateData.uid;
				if(legionData.barSkillUids.Contains(skillUid))
				{
					// 从技能栏列表删除
					legionData.barSkillUids.Remove(skillUid);
					// 设置凹槽为空
					grooveStates[skillOperateData.grooveIndex] = false;
					
					Debug.Log("skillOperateData.skillConfig.isSettledBuild=" + skillOperateData.skillConfig.isSettledBuild);
					// 如果英雄不用入驻建筑
					if(skillOperateData.skillConfig.isSettledBuild == false)
					{
						if(onlyUseOnce == false)
						{
							if(skillOperateData.enableProduce && skillOperateData.isRoleSkill == false)
							{
								// 添加到生产列表
								legionData.enableProduceSkillUids.Add(skillUid);
							}
						}
					}
					else
					{
//						// 添加英雄回到幕后事件
//						skillOperateData.heroData.sBackstage += OnBackstage;
//						// 设置英雄入驻建筑ID
//						skillOperateData.heroData.buildId = skillOperateData.GetReceiveUnitCtl().unitData.id;
//						// 设置英雄为"幕前状态"
//						skillOperateData.heroData.state = HeroState.Foregstage;
//
//						Debug.Log("skillOperateData.heroData.state=" + skillOperateData.heroData.state);
					}

					// 检测是否需要设置生成技能
					CheckProduceSkill();
					// 检测怒气是否满了,如果满了就生产一个技能
					CheckMageFull();
				}
			}
		}
Пример #23
0
		/** 事件--怒气满 */
		void OnMageFull()
		{
			// 获取一个空凹槽
			int index = GetGrooveIndex();
			// 中断执行--没有空凹槽
			if(index == -1) return;
			// 中断执行--没有可以生产的技能
			if(legionData.produceSkillUid == -1) return;

			SkillOperateData skillOperateData = legionData.produceSkillData;
			if (War.isRecord && this.skillOperateData != null)
			{
				skillOperateData = this.skillOperateData;
			}

			// 设置技能”凹槽位置“
			skillOperateData.grooveIndex 		= index;
			skillOperateData.operateState 		= SkillOperateState.Normal;
			// 设置凹槽填充
			grooveStates[skillOperateData.grooveIndex] = true;

			// 从可生产列表删除
			legionData.enableProduceSkillUids.Remove(legionData.produceSkillUid);
			// 添加到技能栏列表
			legionData.barSkillUids.Add(legionData.produceSkillUid);
			
//			Debug.Log("legionData.enableProduceSkillIds.Count=" + legionData.enableProduceSkillUids.Count);
//			Debug.Log("legionData.barSkillIds.Count=" + legionData.barSkillUids.Count);


			// 怒气置0
			legionData.mage 			= 0f;
			// 设置下一个生产技能ID
			SetProduceSkill();
				

			if(legionData.legionId == War.ownLegionID)
			{
				War.signal.SkillProduceOwn (skillOperateData);
			}


			isProduceComplete = true;
			if (War.isRecord) 
			{
				this.skillOperateData = legionData.produceSkillData;
			}
		}
Пример #24
0
		public void SetProduceSkill(int skillUid, float speed = -1)
		{
			legionData.produceSkillUid = skillUid;

			if (isProduceComplete) 
			{
				skillOperateData = legionData.produceSkillData;
				isProduceComplete = false;
			}

			if (speed != -1)
			{
				legionData.unitData.mageSpeed = speed;
			}

			War.signal.DoSetProductionSkill (legionData.legionId, skillUid, legionData.unitData.mageSpeed);
		}
Пример #25
0
        public void OnUse(SkillOperateData operateData)
        {
            UnitCtl caster = operateData.caster != null ? operateData.caster : operateData.heroData.unit.GetComponent <UnitCtl>();

            operateData.caster = caster;


            if (operateData.isRoleSkill)
            {
                War.skillWarManager.DealSkill(operateData);
            }
            else
            {
                heroSkillClipManager.OnUse(operateData);
                StartCoroutine(DelayUse(operateData));
            }
        }
Пример #26
0
        void CreateHero(int itemLegionId, int itemHeroId, int avatarId, string name, int quality, int skillId, int skillLevel, float[] hero2BuildProps, float[] props)
        {
            // 创建英雄单位数据UnitData
            UnitData unitData = new UnitData();

            unitData.unitType = UnitType.Hero;
            unitData.id       = GetHeroUID(itemHeroId, itemLegionId);

            // 将“英雄单位数据UnitData”保存到”势力数据LegionData“里
            LegionData legionData = legionDict[itemLegionId];

            legionData.heroUnitDatas.Add(itemHeroId, unitData);

            unitData.legionId = legionData.legionId;

            // 创建英雄数据HeroData
            HeroData heroData = new HeroData();

            heroData.heroUid        = unitData.id;
            heroData.heroId         = itemHeroId;
            heroData.name           = name;
            heroData.quality        = quality;
            heroData.avatarId       = avatarId;
            heroData.originalLegion = legionData.legionId;
            legionData.heroDatas.Add(heroData.heroId, heroData);
            legionData.heroInitProp.Add(heroData.heroId, props);
            legionData.hero2BuildProp.Add(heroData.heroId, hero2BuildProps);



            // 如果英雄技能激活了,生成英雄技能操作数据
            if (skillId > 0)
            {
                SkillOperateData skillData = new SkillOperateData();
                skillData.skillId     = skillId;
                skillData.uid         = GetSkillUID(skillData.skillId, legionData.legionId, heroData.heroId);
                skillData.skillLevel  = skillLevel;
                skillData.heroData    = heroData;
                skillData.skillConfig = enterData.GetSkillConfig(skillData.skillId);
                skillData.Init();
                heroData.skillOperateData = skillData;
                legionData.skillDatas.Add(skillData.uid, skillData);
                skillOperateDataForUID.Add(skillData.uid, skillData);
            }
        }
Пример #27
0
        /** 技能 */
        public void ExeSkill(C_SyncSkill_0x822 msg)
        {
            SkillOperateData skillOperateData = War.sceneData.GetSkillOperateData(msg.uid);

            if (skillOperateData.isRoleSkill)
            {
                War.skillWarManager.DealSkillForPvp(WarService.To__S_SyncSkill_0x822(msg));
            }
            else
            {
                if (skillOperateData != null)
                {
                    skillOperateData.SetUse();
                }

                StartCoroutine(DelayPlaySkill(msg));
            }
        }
Пример #28
0
		void OnHeroSettledBuild(int legionId, int skillUid, int buildId)
		{
			if(legionId == legionData.legionId)
			{
				SkillOperateData skillOperateData = legionData.skillDatas[skillUid];

				if(skillOperateData.skillConfig.isSettledBuild)
				{
					// 添加英雄回到幕后事件
					skillOperateData.heroData.sBackstage += OnBackstage;
					// 设置英雄入驻建筑ID
					skillOperateData.heroData.buildId = buildId;
					// 设置英雄为"幕前状态"
					skillOperateData.heroData.state = HeroState.Foregstage;
					
//					Debug.Log("skillOperateData.heroData.state=" + skillOperateData.heroData.state);

				}
			}
		}
Пример #29
0
        public void UseSkill(SkillOperateData skillData)
        {
            if (skillData.relation == RelationType.Own)
            {
                skillData.heroData.legionData.CancelSkillOperator(skillData);

                OperateAction action = null;

                switch (skillData.skillConfig.operate)
                {
                case SkillOperateType.Immediately:
                    skillData.OnUse();
                    break;

                case SkillOperateType.Passive:
                    skillData.OnUse();
                    break;

                case SkillOperateType.SelectUnit:
                    action = new SelectUnitAction();
                    break;

                case SkillOperateType.SelectCircle:
                    action = new SelectCircleAction();
                    break;

                case SkillOperateType.SelectDirection:
                    action = new SelectDirectionAction();
                    break;
                }


                if (action != null)
                {
                    action.skillUse  = this;
                    action.skillData = skillData;
                    action.Enter();
                }
            }
        }
Пример #30
0
        /** 技能 */
        public void ExeSkill(int skillUID, List <int> unitIds, Vector3 position)
        {
            SkillOperateData skillOperateData = War.sceneData.GetSkillOperateData(skillUID);

            if (skillOperateData != null)
            {
                skillOperateData.receiveList.Clear();
                foreach (int uid in unitIds)
                {
                    UnitCtl unit = War.scene.GetUnitForUID(uid);
                    if (unit != null)
                    {
                        skillOperateData.receiveList.Add(unit);
                    }
                }

                skillOperateData.receivePosition = position;
                skillOperateData.S_Use();
            }
            else
            {
                Debug.Log(string.Format("<color=red>WarPVP.S_Skill skillOperateData=null  skillUID={0} </color>", skillUID));
            }
        }