Exemple #1
0
    public void AddShow(HudType _hudType, HudStateType _state = HudStateType.Destroy)
    {
        int id = GetPanel(_hudType);

        hudDic[id].state = _state;
        hudDic[id].gameObject.SetActive(true);
        openList.Add(id);
    }
Exemple #2
0
    public void AddHud(HudType type, NDictionary args = null)
    {
        HudInfo info = new HudInfo();

        info.type = type;
        info.args = args;
        hudInfoList.Add(info);
    }
Exemple #3
0
    public void Show(HudType _hudType, HudStateType _state = HudStateType.Hidden)
    {
        CloseAll();
        int id = GetPanel(_hudType);

        hudDic[id].state = _state;
        hudDic[id].gameObject.SetActive(true);
        openList.Add(id);
    }
Exemple #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HudBase&lt;TAvatar&gt;"/> class.
 /// </summary>
 /// <param name="aw">The aw.</param>
 /// <param name="id">The id.</param>
 /// <param name="content">The content.</param>
 /// <param name="type">The type.</param>
 /// <param name="origin">The origin.</param>
 /// <param name="opacity">The opacity.</param>
 /// <param name="position">The position.</param>
 /// <param name="flags">The flags.</param>
 /// <param name="size">The size.</param>
 /// <param name="color">The color.</param>
 protected HudBase(Instance aw, int id, string content, HudType type, HudOrigin origin, float opacity, Vector3 position, HudElementFlag flags, Vector3 size, int color)
 {
     this._aw = aw;
     Id       = id;
     Content  = content;
     Type     = type;
     Origin   = origin;
     Opacity  = opacity;
     Position = position;
     Flags    = flags;
     Size     = size;
     Color    = color;
 }
Exemple #5
0
 public void RemoveHud(HudType type)
 {
     for (int i = hudInfoList.Count - 1; i >= 0; i--)
     {
         HudInfo info = hudInfoList[i];
         if (info.type == type)
         {
             if (info.hudGo != null)
             {
                 IPoolUnit unit = info.hudGo.GetComponent <IPoolUnit>();
                 unit.Restore();
                 info.hudGo = null;
             }
             hudInfoList.RemoveAt(i);
         }
     }
 }
Exemple #6
0
    /**
     * Update life or power bar to a certain value
     * @param HudType _hudType Is it power HUD or Life HUD
     * @param float _levelPercent Number between 0 and 100 that will graphically sets the filling percentage of the gauje
     **/
    public void setLevel(HudType _hudType, float _levelPercent)
    {
        GameObject hudTarget = null;

        if (_hudType == HudType.Life)
        {
            hudTarget = hudLife;
        }
        else if (_hudType == HudType.Special)
        {
            hudTarget = hudSpecial;
        }

        if (hudTarget != null)
        {
            hudTarget.transform.localScale = new Vector3(1, _levelPercent/100, 1);
        }
    }
Exemple #7
0
    public int GetPanel(HudType _hudType)
    {
        //find exsit.
        foreach (KeyValuePair <int, HudBase> tempHud in hudDic)
        {
            if (tempHud.Value._type == _hudType)
            {
                return(tempHud.Key);
            }
        }

        int id = InstanceHepler.Get();

        HudBase _hudbase = HudLoader.Instance.Load <HudBase>(_hudType.ToString());

        _hudbase._type = _hudType;

        if (_hudbase != null)
        {
            _hudbase.tran.parent           = tran;
            _hudbase.tran.localPosition    = Vector3.zero;
            _hudbase.tran.localEulerAngles = Vector3.zero;
            _hudbase.tran.localScale       = Vector3.one;

            if (!hudDic.ContainsKey(id))
            {
                hudDic.Add(id, _hudbase);
            }
            else
            {
                Debug.Log("exsit instance id : " + id);
            }
        }
        else
        {
            id = -1;
        }

        return(id);
    }
Exemple #8
0
 GameObject GetHudPrefab(HudType type)
 {
     return(Resources.Load <GameObject>("Prefabs/Hud/" + type.ToString()));
 }