コード例 #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);
    }
コード例 #2
0
ファイル: HudBinder.cs プロジェクト: Wen1995/Project60D
    public void AddHud(HudType type, NDictionary args = null)
    {
        HudInfo info = new HudInfo();

        info.type = type;
        info.args = args;
        hudInfoList.Add(info);
    }
コード例 #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);
    }
コード例 #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;
 }
コード例 #5
0
ファイル: HudBinder.cs プロジェクト: Wen1995/Project60D
 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);
         }
     }
 }
コード例 #6
0
ファイル: HudMaster.cs プロジェクト: ifgx/scripts-spr3
    /**
     * 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);
        }
    }
コード例 #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);
    }
コード例 #8
0
ファイル: HudBinder.cs プロジェクト: Wen1995/Project60D
 GameObject GetHudPrefab(HudType type)
 {
     return(Resources.Load <GameObject>("Prefabs/Hud/" + type.ToString()));
 }