public void SetMainColor(ImageMenuItem item)
 {
     if (item.Child is Label && item.Image is ColorBlockWidget)
     {
         IconWidget = (item.Image as ColorBlockWidget).Clone();
         IconWidget.Show();
         Label = (item.Child as Label).Text;
     }
 }
示例#2
0
    protected override void OnStart()
    {
        //Debug.LogError("BattlePanel onstart");
        m_PauseBtn  = this.GetChild("PauseBtn");
        m_ResumeBtn = this.GetChild("ResumeBtn");

        IconWidget widget1 = new IconWidget();

        widget1.ControlObject = this.GetChild("Warrior1");
        widget1.IconTexture   = this.GetChild("WarriorIcon1").GetComponent <UITexture> ();
        widget1.BackTexture   = this.GetChild("WarriorBack1").GetComponent <UISprite> ();
        widget1.HpSlider      = this.GetChild("HpSlider1").GetComponent <UISlider>();
        widget1.BPSlider      = this.GetChild("BpSlider1").GetComponent <UISlider>();
        Transform f1 = widget1.BPSlider.transform.FindRecursively("Foreground");

        widget1.BPTweenColor = f1.gameObject.GetComponent <TweenColor>();
        widget1.CDTimeLabel  = this.GetChild("WarriorLabel1").GetComponent <UILabel>();
        widget1.AniSprite    = this.GetChild("AniSprite1");
        m_IconWidgetList.Add(widget1);

        IconWidget widget2 = new IconWidget();

        widget2.ControlObject = this.GetChild("Warrior2");
        widget2.IconTexture   = this.GetChild("WarriorIcon2").GetComponent <UITexture>();
        widget2.BackTexture   = this.GetChild("WarriorBack2").GetComponent <UISprite>();
        widget2.HpSlider      = this.GetChild("HpSlider2").GetComponent <UISlider>();
        widget2.BPSlider      = this.GetChild("BpSlider2").GetComponent <UISlider>();
        Transform f2 = widget2.BPSlider.transform.FindRecursively("Foreground");

        widget2.BPTweenColor = f2.gameObject.GetComponent <TweenColor>();
        widget2.CDTimeLabel  = this.GetChild("WarriorLabel2").GetComponent <UILabel>();
        widget2.AniSprite    = this.GetChild("AniSprite2");
        m_IconWidgetList.Add(widget2);

        IconWidget widget3 = new IconWidget();

        widget3.ControlObject = this.GetChild("Warrior3");
        widget3.IconTexture   = this.GetChild("WarriorIcon3").GetComponent <UITexture>();
        widget3.BackTexture   = this.GetChild("WarriorBack3").GetComponent <UISprite>();
        widget3.HpSlider      = this.GetChild("HpSlider3").GetComponent <UISlider>();
        widget3.BPSlider      = this.GetChild("BpSlider3").GetComponent <UISlider>();
        Transform f3 = widget3.BPSlider.transform.FindRecursively("Foreground");

        widget3.BPTweenColor = f3.gameObject.GetComponent <TweenColor>();
        widget3.CDTimeLabel  = this.GetChild("WarriorLabel3").GetComponent <UILabel>();
        widget3.AniSprite    = this.GetChild("AniSprite3");
        m_IconWidgetList.Add(widget3);

        IconWidget widget4 = new IconWidget();

        widget4.ControlObject = this.GetChild("Warrior4");
        widget4.IconTexture   = this.GetChild("WarriorIcon4").GetComponent <UITexture>();
        widget4.BackTexture   = this.GetChild("WarriorBack4").GetComponent <UISprite>();
        widget4.HpSlider      = this.GetChild("HpSlider4").GetComponent <UISlider>();
        widget4.BPSlider      = this.GetChild("BpSlider4").GetComponent <UISlider>();
        Transform f4 = widget4.BPSlider.transform.FindRecursively("Foreground");

        widget4.BPTweenColor = f4.gameObject.GetComponent <TweenColor>();
        widget4.CDTimeLabel  = this.GetChild("WarriorLabel4").GetComponent <UILabel>();
        widget4.AniSprite    = this.GetChild("AniSprite4");
        m_IconWidgetList.Add(widget4);
    }