Esempio n. 1
0
        private void InitBtnInfo()
        {
            List <PoolObjHandle <ActorRoot> > list = ActorHelper.FilterActors(Singleton <GameObjMgr> .instance.HeroActors, new ActorFilterDelegate(Singleton <BattleLogic> .instance.FilterEnemyActor));

            this.m_iCurEnemyPlayerCount = list.get_Count();
            if (this.m_iCurEnemyPlayerCount > 5)
            {
                this.m_iCurEnemyPlayerCount = 5;
            }
            CEnemyHeroAtkBtn.m_UI3DCamera = Singleton <Camera_UI3D> .GetInstance().GetCurrentCamera();

            this.m_ui3dRes = Singleton <CGameObjectPool> .GetInstance().GetGameObject("Prefab_Skill_Effects/Common_Effects/EnemyHeroAttack", enResourceType.BattleScene);

            float num = 1f;

            if (Singleton <CBattleSystem> .instance.FightFormScript != null)
            {
                num = Singleton <CBattleSystem> .instance.FightFormScript.GetScreenScaleValue();
            }
            if (this.m_ui3dRes != null)
            {
                this.m_ui3dRes.transform.SetParent(CEnemyHeroAtkBtn.m_UI3DCamera.transform, true);
                if (this.m_objSelectedImg == null)
                {
                    this.m_objSelectedImg = this.m_ui3dRes.transform.FindChild("selected").gameObject;
                    if (this.m_objSelectedImg)
                    {
                        Sprite3D component = this.m_objSelectedImg.GetComponent <Sprite3D>();
                        if (component)
                        {
                            component.width  *= num;
                            component.height *= num;
                        }
                        this.m_objDirection = this.m_objSelectedImg.transform.FindChild("direction").gameObject;
                        if (this.m_objDirection)
                        {
                            Vector3 position = this.m_objDirection.transform.position;
                            position.y *= num;
                            this.m_objDirection.transform.position = position;
                            component = this.m_objDirection.GetComponent <Sprite3D>();
                            if (component)
                            {
                                component.width  *= num;
                                component.height *= num;
                            }
                        }
                    }
                }
                if (this.m_attackLinker == null)
                {
                    this.m_objLinker = this.m_ui3dRes.transform.FindChild("linker").gameObject;
                    if (this.m_objLinker)
                    {
                        this.m_attackLinker = this.m_objLinker.GetComponent <LineRenderer>();
                        if (this.m_attackLinker != null && CEnemyHeroAtkBtn.m_UI3DCamera)
                        {
                            this.m_attackLinker.SetVertexCount(2);
                            this.m_attackLinker.useWorldSpace = true;
                        }
                    }
                }
            }
            for (int i = 0; i < this.m_iCurEnemyPlayerCount; i++)
            {
                Transform transform   = this.m_objPanelEnemyHeroAtk.transform.FindChild(CEnemyHeroAtkBtn.m_arrHeroBtnNames[i]);
                string    heroSkinPic = CSkinInfo.GetHeroSkinPic((uint)list.get_Item(i).handle.TheActorMeta.ConfigId, 0u);
                string    prefabPath  = CUIUtility.s_Sprite_Dynamic_BustCircle_Dir + heroSkinPic;
                Image     component2  = transform.GetComponent <Image>();
                if (component2)
                {
                    component2.SetSprite(prefabPath, Singleton <CBattleSystem> .GetInstance().FormScript, true, false, false, false);
                }
                if (this.m_ui3dRes != null)
                {
                    GameObject gameObject = this.m_ui3dRes.transform.FindChild("hp_" + i).gameObject;
                    if (gameObject)
                    {
                        Sprite3D component3 = gameObject.GetComponent <Sprite3D>();
                        if (component3)
                        {
                            component3.width  *= num;
                            component3.height *= num;
                        }
                        GameObject gameObject2 = gameObject.transform.FindChild("hp").gameObject;
                        if (gameObject2)
                        {
                            Sprite3D component4 = gameObject2.GetComponent <Sprite3D>();
                            component4.width    *= num;
                            component4.height   *= num;
                            this.m_arrBtnInfo[i] = new CEnemyHeroAtkBtn.BTN_INFO(transform, list.get_Item(i), CEnemyHeroAtkBtn.ENM_ENEMY_HERO_STATE.ENM_ENEMY_HERO_STATE_TOOFAR, true, gameObject, component4);
                        }
                    }
                }
            }
        }