Exemplo n.º 1
0
        protected override void PostSetup()
        {
            base.PostSetup();
            this.LoadUnitAnimationAsync("idle", "unit_info_idle0", true, false);
            this.LoadUnitAnimationAsync("action", "unit_info_act0", true, false);
            JobData       jobData  = Array.Find <JobData>(this.GUnitData.Jobs, (Predicate <JobData>)(p => p.JobID == this.mCurrentJobID));
            SkillSequence sequence = SkillSequence.FindSequence(jobData == null ? this.GUnitData.CurrentJob.GetAttackSkill().SkillParam.motion : jobData.GetAttackSkill().SkillParam.motion);

            if (sequence == null)
            {
                return;
            }
            if (sequence.SkillAnimation.Name.Length > 0)
            {
                this.LoadUnitAnimationAsync("B_SKL", sequence.SkillAnimation.Name, false, false);
            }
            this.StartCoroutine(this.LoadThread());
        }
Exemplo n.º 2
0
        private void Start()
        {
            if (Object.op_Inequality((Object)this.RangeTemplate, (Object)null))
            {
                this.RangeTemplate.SetActive(false);
            }
            if (Object.op_Inequality((Object)this.SpaceTemplate, (Object)null))
            {
                this.SpaceTemplate.SetActive(false);
            }
            UnitData unitDataByUniqueId = MonoSingleton <GameManager> .Instance.Player.FindUnitDataByUniqueID((long)GlobalVars.SelectedUnitUniqueID);

            if (unitDataByUniqueId == null)
            {
                DebugUtility.Log("Not Selected Unit!!");
            }
            else
            {
                JobData jobData             = unitDataByUniqueId.CurrentJob;
                long    selectedJobUniqueId = (long)GlobalVars.SelectedJobUniqueID;
                for (int index = 0; index < unitDataByUniqueId.Jobs.Length; ++index)
                {
                    if (unitDataByUniqueId.Jobs[index].UniqueID == selectedJobUniqueId)
                    {
                        jobData = unitDataByUniqueId.Jobs[index];
                        break;
                    }
                }
                SkillData       attackSkill    = jobData.GetAttackSkill();
                int             attackRangeMax = unitDataByUniqueId.GetAttackRangeMax(attackSkill);
                int             attackRangeMin = unitDataByUniqueId.GetAttackRangeMin(attackSkill);
                ESelectType     selectRange    = attackSkill.SkillParam.select_range;
                GridLayoutGroup component1     = (GridLayoutGroup)((Component)this.Parent).GetComponent <GridLayoutGroup>();
                if (Object.op_Equality((Object)component1, (Object)null))
                {
                    DebugUtility.Log("Parent is not attachment GridLayoutGroup");
                }
                else
                {
                    component1.set_constraintCount(Mathf.Max(attackRangeMax * 2 + 1, UnitAttackRangeWindow.RANGE_BLOCK_MAX));
                    if (component1.get_constraintCount() > UnitAttackRangeWindow.RANGE_BLOCK_MAX + 1)
                    {
                        component1.set_cellSize(new Vector2((float)this.BlockSize, (float)this.BlockSize));
                        component1.set_spacing(new Vector2(5f, 5f));
                    }
                    int           num         = component1.get_constraintCount() / 2;
                    List <string> stringList1 = new List <string>();
                    List <string> stringList2;
                    switch (selectRange)
                    {
                    case ESelectType.Diamond:
                        stringList2 = this.GetDiamondRange(new Vector2((float)num, (float)num), attackRangeMin, attackRangeMax);
                        break;

                    case ESelectType.Square:
                        stringList2 = this.GetSquareRange(new Vector2((float)num, (float)num), attackRangeMin, attackRangeMax);
                        break;

                    case ESelectType.Laser:
                        stringList2 = this.GetLaserRange(new Vector2((float)num, (float)num), attackRangeMin, attackRangeMax);
                        break;

                    case ESelectType.All:
                        stringList2 = this.GetAllRange(new Vector2((float)num, (float)num), attackRangeMin, attackRangeMax);
                        break;

                    case ESelectType.Bishop:
                        stringList2 = this.GetBishopRange(new Vector2((float)num, (float)num), attackRangeMin, attackRangeMax);
                        break;

                    case ESelectType.Horse:
                        stringList2 = this.GetHorseRange(new Vector2((float)num, (float)num), attackRangeMin, attackRangeMax);
                        break;

                    default:
                        stringList2 = this.GetCrossRange(new Vector2((float)num, (float)num), attackRangeMin, attackRangeMax);
                        break;
                    }
                    for (int index1 = 0; index1 < component1.get_constraintCount(); ++index1)
                    {
                        for (int index2 = 0; index2 < component1.get_constraintCount(); ++index2)
                        {
                            string     str         = index2.ToString() + "," + index1.ToString();
                            GameObject gameObject1 = this.SpaceTemplate;
                            if (stringList2.IndexOf(str) != -1 || index2 == num && index1 == num)
                            {
                                gameObject1 = this.RangeTemplate;
                            }
                            GameObject gameObject2 = (GameObject)Object.Instantiate <GameObject>((M0)gameObject1);
                            gameObject2.get_transform().SetParent(this.Parent, false);
                            ((Object)gameObject2).set_name("Grid" + index2.ToString() + "-" + index1.ToString());
                            gameObject2.SetActive(true);
                            if (!Object.op_Equality((Object)gameObject1, (Object)this.SpaceTemplate))
                            {
                                Image component2 = (Image)gameObject2.GetComponent <Image>();
                                if (index2 == num && index1 == num)
                                {
                                    ((Graphic)component2).set_color(Color32.op_Implicit(new Color32((byte)0, byte.MaxValue, byte.MaxValue, byte.MaxValue)));
                                }
                                else
                                {
                                    ((Graphic)component2).set_color(Color32.op_Implicit(new Color32(byte.MaxValue, (byte)0, (byte)0, byte.MaxValue)));
                                }
                            }
                        }
                    }
                    string str1 = LocalizedText.Get("sys.MINMAX_VALUE", (object)attackRangeMin.ToString(), (object)attackRangeMax.ToString());
                    if (!Object.op_Inequality((Object)this.RangeMinMax, (Object)null))
                    {
                        return;
                    }
                    this.RangeMinMax.set_text(str1);
                }
            }
        }