Example #1
0
        public void Init(GameObject con)
        {
            container = con;

            if (skillIconGO)
            {
                skillIconGO.SetActive(true);
                return;
            }

            unitVec = new BattleSkillIconUnit[unitNum];


            for (int i = 0; i < unitNum; i++)
            {
                unitVec[i] = new BattleSkillIconUnit();
            }

            Action <GameObject> loadGameObject = delegate(GameObject _go)
            {
                skillIconGO = _go;
                skillIconGO.transform.SetParent(container.transform, false);
                mr  = _go.GetComponent <MeshRenderer>();
                mat = mr.material;
            };

            GameObjectFactory.Instance.GetGameObject("Assets/Arts/battle/BattleTool/SkillIcon.prefab", loadGameObject, true);
        }
        public void Update()
        {
            if (mr != null)
            {
                for (int i = 0; i < unitNum; i++)
                {
                    BattleSkillIconUnit unit = unitVec[i];

                    if (unit.State == 1 || unit.IsChange)
                    {
                        if (unit.IsChange)
                        {
                            unit.IsChange = false;
                        }

                        unit.GetPositionsVec(mr.material);

                        unit.GetFixVec(mr.material);

                        unit.GetScaleFix(mr.material);

//						mr.material.SetVector("positions" + i.ToString(), unit.GetPositionsVec());
//
//						mr.material.SetVector("fix" + i.ToString(), unit.GetFixVec());
//
//                        mr.material.SetVector("scaleFix" + i.ToString(), unit.GetScaleFix());
                    }
                }
            }
        }
Example #3
0
        public void DelSkillIcon(BattleSkillIconUnit _unit)
        {
            _unit.alpha    = 0;
            _unit.State    = 0;
            _unit.IsChange = true;

            if (_unit.endBack != null)
            {
                Action <BattleSkillIconUnit, Action> endBack = _unit.endBack;
                endBack(_unit, _unit.callBack);
            }
        }
Example #4
0
        private void readyToDelSkillIcon(BattleSkillIconUnit _unit)
        {
            Action <float> toCall = delegate(float value)
            {
                _unit.alpha = value;
            };

            Action endCall = delegate()
            {
                DelSkillIcon(_unit);
            };

            SuperTween.Instance.To(_unit.alpha, 0, 1, toCall, endCall);
        }
        public BattleSkillIconUnit GetSkillIcon(string _name, float _time, float _height, GameObject _go, Action <BattleSkillIconUnit, Action> endBack, Action _callBack)
        {
            for (int i = 0; i < unitNum; i++)
            {
                if (unitVec[i].State == 0)
                {
                    BattleSkillIconUnit unit = unitVec[i];
                    unit.Init(_height, _go);

                    unit.alpha = 1;
                    unit.State = 1;

                    Action <Sprite> callBack = delegate(Sprite _texture)
                    {
                        mat.mainTexture = _texture.texture;

                        unit.endBack  = endBack;
                        unit.callBack = _callBack;

                        unit.uFix  = _texture.textureRect.x / _texture.texture.width;
                        unit.vFix  = _texture.textureRect.y / _texture.texture.height;
                        unit.alpha = 1;

                        Action delayCall = delegate()
                        {
                            readyToDelSkillIcon(unit);
                        };

                        int id = SuperTween.Instance.DelayCall(_time, delayCall);
                        SuperTween.Instance.SetTag(id, "battle_tag");
                    };

                    TextureFactory.Instance.GetTexture("Assets/Arts/ui/skillIcon/" + _name + ".png", callBack, true);

                    return(unit);
                }
            }

            throw new Exception("SkillIcon is out of use!!!");
        }