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));
            }
        }