예제 #1
0
 public void Initialize()
 {
     if (control == null)
         control = GetComponent<dfControl>();
     s = gameObject.GetComponent<dfProgressBar>();
     s.MinValue = 0;
     bvl = GetComponentInChildren<barValueLabel>();
     switch (owner)
     {
         case spawnBars.hudOwner.Player:
             hull = Target.GetComponentInChildren<Hull>();
             break;
         case spawnBars.hudOwner.Enemy:
             hull = Target.GetComponentInChildren<Hull>();
             if (Target.layer == LayerMask.NameToLayer("NonPlayer"))
             {
                 Target.GetComponent<NPCController>().setBars(transform.parent.gameObject);//Redundant because it is also in Shieldbar script
             }
             else
                 Target.GetComponent<EnemyController>().setBars(transform.parent.gameObject);//Redundant because it is also in Shieldbar script
             break;
     }
     if (isGUITarget)
     {
         GUIReciever.hull = hull;
         GUIReciever.GUITarget = this;
     }
     if (owner != spawnBars.hudOwner.GUI)
     {
         hull.hBar = this;
         setValue();
     }
 }
예제 #2
0
	public void Initialize () 
    {
        if (control == null)
            control = GetComponent<dfControl>();
        s = GetComponent<dfProgressBar>();
        s.MinValue = 0;
        bvl = GetComponentInChildren<barValueLabel>();
        switch (owner)
        {
            case spawnBars.hudOwner.Player:
                shields = Target.GetComponentInChildren<Shield>();

                break;
            case spawnBars.hudOwner.Enemy:
                shields = Target.GetComponentInChildren<Shield>();
                break;
        }
        if (isGUITarget)
        {
            GUIReciever.shields = shields;
            GUIReciever.GUITarget = this;
            GUIReciever2.shields = shields;
            GUIReciever2.GUITarget = this;
        }
        if (owner != spawnBars.hudOwner.GUI)
        {
            shields.sBar = this;
            setValue();
        }
	}
예제 #3
0
 public void resetValue()
 {
     hpm = transform.parent.GetComponent<HPPowerManager>();
     b = GetComponent<dfProgressBar>();
     b.MaxValue = 5;
     b.Value = 0;
 }
예제 #4
0
 public void initialize()
 {
     spm = transform.parent.GetComponent<SystemPowerManager>();
     b = GetComponent<dfProgressBar>();
     b.MaxValue = 5;
     b.Value = spm.system.PowerAllocation;
 }
예제 #5
0
    public virtual void Show()
    {
        if (showTweensDestination != null)
        {
            showTweensDestination.Play();
        }
        else
        {
            owner.Show();
        }

        dfProgressBar bar = GetComponent <dfProgressBar>();

        if (bar == null)
        {
            bar = GetComponentInChildren <dfProgressBar>();
        }
        if (bar == null)
        {
            return;
        }

        bar.Hide();
        bar.Value = 0;
    }
예제 #6
0
 protected internal override void OnKeyDown(dfKeyEventArgs args)
 {
     try
     {
         if (this.actAsSlider)
         {
             float single = (this.maxValue - this.minValue) * 0.1f;
             if (args.KeyCode == KeyCode.LeftArrow)
             {
                 dfProgressBar value = this;
                 value.Value = value.Value - single;
                 args.Use();
             }
             else if (args.KeyCode == KeyCode.RightArrow)
             {
                 dfProgressBar _dfProgressBar = this;
                 _dfProgressBar.Value = _dfProgressBar.Value + single;
                 args.Use();
             }
         }
     }
     finally
     {
         base.OnKeyDown(args);
     }
 }
예제 #7
0
        IEnumerator coroutineLoading(string levelName, dfProgressBar bar, ISwitchPanelBehaviour switchPanel)
        {
            async = Application.LoadLevelAsync(levelName);

again:
            if (async.isDone)
            {
                Debug.Log("completed");
                if (switchPanel != null)
                {
                    switchPanel.Switch();
                }
            }
            else
            {
                Debug.Log("LoadNewLevel: async.progress=" + async.progress);
                if (bar != null)
                {
                    bar.Value = async.progress;
                }
                yield return(new WaitForEndOfFrame());

                goto again;
            }
        }
예제 #8
0
 public LevelFactory(string levelName, dfProgressBar loadingBar, ISwitchPanelBehaviour panelBehaviour)
 {
     _loaders = new List <LevelLoader>
     {
         new ReloadCurrent(levelName, loadingBar, panelBehaviour),
         new LoadNewLevel(levelName, loadingBar, panelBehaviour),
     };
 }
예제 #9
0
    protected override void Start()
    {
        base.Start();

        hpBar = FindObjectOfType<dfGUIManager>().AddPrefab(HPBarPrefab).GetComponent<dfProgressBar>();
        hpBar.Pivot = dfPivotPoint.MiddleCenter;
        hpBar.ZOrder = 1;
    }
    // Called by Unity just before any of the Update methods is called the first time.
    void Start()
    {
        this._progressBar = GetComponent <dfProgressBar>();

        this._progressBar.MaxValue = defender.health;
        this._progressBar.Value    = defender.health;
        UpdateLabel();

        // Obtain a reference to the dfProgressBar instance attached to this object
    }
예제 #11
0
 public void setValue()
 {
     if(s == null)
         s = gameObject.GetComponent<dfProgressBar>();
     s.Value = planet.health;
     if (bvl == null)
     {
         bvl = GetComponentInChildren<barValueLabel>();
     }
 }
예제 #12
0
 public void Initialize(DefendThePlanetObjective dtpo)
 {
     planet = dtpo;
     planet.pbs = this;
     if (control == null)
         control = GetComponent<dfControl>();
     s = gameObject.GetComponent<dfProgressBar>();
     s.MinValue = 0;
     s.MaxValue = planet.maxHealth;
     bvl = GetComponentInChildren<barValueLabel>();
     setValue();
 }
예제 #13
0
파일: DFBind.cs 프로젝트: Hengle/Tetris-1
 public static ISubscription bind(
     this IObservable <ValueWithStorage> subject, dfProgressBar control
     )
 {
     return(withTween(set => subject.subscribe(value => {
         control.MinValue = 0;
         // 0 out of 0 yields full progress bar which is not what we want.
         control.MaxValue = value.value == 0 && value.storage == 0
   ? 1 : value.storage;
         set(Go.to(
                 TF.a(() => control.Value, v => control.Value = v),
                 TWEEN_DURATION, tCfg.floatProp(TF.Prop, value.value)
                 ));
     })));
 }
예제 #14
0
 public void setValue()
 {
     if(s == null && gameObject!=null)
         s = gameObject.GetComponent<dfProgressBar>();
     s.MaxValue = hull.MaxHull;
     s.Value = hull.hull;
     if (bvl == null)
     {
         bvl = GetComponentInChildren<barValueLabel>();
     }
     if(bvl!=null)
         bvl.setValue( hull.hull,hull.MaxHull);
     if (isGUITarget)
     {
         GUIReciever.setValue();
     }
 }
예제 #15
0
 protected internal override void OnMouseWheel(dfMouseEventArgs args)
 {
     try
     {
         if (this.actAsSlider)
         {
             float         single = (this.maxValue - this.minValue) * 0.1f;
             dfProgressBar value  = this;
             value.Value = value.Value + single * (float)Mathf.RoundToInt(-args.WheelDelta);
             args.Use();
         }
     }
     finally
     {
         base.OnMouseWheel(args);
     }
 }
예제 #16
0
 public void setValue()
 {
     if (s == null)
         s = gameObject.GetComponent<dfProgressBar>();
     s.MaxValue = shields.MaxShield;
     s.Value = shields.Shields;
     if (bvl == null)
     {
         bvl = GetComponentInChildren<barValueLabel>();
     }
     if (bvl != null)
         bvl.setValue(shields.Shields, shields.MaxShield);
     if (isGUITarget)
     {
         GUIReciever.setValue();
         GUIReciever2.setValue();
     }
 }
    public int ChangeLifePoints(int delta)
    {
        lifePoints += delta;
        if (healthBar != null)
        {
            dfPanel dfp = healthBar.GetComponent <dfPanel> ();
            dfp.IsVisible = true;
            dfProgressBar dpb = dfp.GetComponentInChildren <dfProgressBar> ();

            if (delta < 0)
            {
                dfLabel minus = dfp.GetComponentInChildren <dfLabel> ();
                minus.IsVisible = true;
            }
            dpb.Value = lifePoints;
        }
        return(lifePoints);
    }
예제 #18
0
    void OnEnable()
    {
        Container = GetComponent<dfPanel>();
        if( Container == null )
        {
            this.enabled = false;
        }

        NameLabel = Container.Find<dfLabel>( "Name" );
        DescriptionLabel = Container.Find<dfLabel>( "Description" );
        ProgressLabel = Container.Find<dfLabel>( "ProgressLabel" );
        Icon = Container.Find<dfSprite>( "Icon" );
        ProgressBar = Container.Find<dfProgressBar>( "ProgressBar" );

        Container.BackgroundSprite = "frame-style6";
        NameLabel.BackgroundSprite = null;
        ProgressBar.Opacity = 0.5f;
    }
예제 #19
0
 // Called by Unity just before any of the Update methods is called the first time.
 public void Start()
 {
     // Obtain a reference to the dfProgressBar instance attached to this object
     this._progressBar = GetComponent<dfProgressBar>();
     game = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameController>();
 }
예제 #20
0
 protected LevelLoader(string levelName, dfProgressBar _loadingBar, ISwitchPanelBehaviour _switchableBehaviour)
 {
     LevelName           = levelName;
     loadingBar          = _loadingBar;
     switchableBehaviour = _switchableBehaviour;
 }
예제 #21
0
 public LoadNewLevel(string levelName, dfProgressBar _loadingBar, ISwitchPanelBehaviour _switchableBehaviour)
     : base(levelName, _loadingBar, _switchableBehaviour)
 {
 }
예제 #22
0
	public void initalize()//Can be called when power generator is changed
    {
        b = GetComponent<dfProgressBar>();
    }  
예제 #23
0
 public ReloadCurrent(string levelName, dfProgressBar _loadingBar, ISwitchPanelBehaviour _switchableBehaviour)
     : base(levelName, _loadingBar, _switchableBehaviour)
 {
 }