Beispiel #1
0
    void OnInitHeadBar(params object[] param)
    {
        Character cha = param[0] as Character;

        ResourceSystem.LoadAsync <GameObject>("GUI/UI_HeadBar", (o) =>
        {
            GameObject go = GameObject.Instantiate(o) as GameObject;
            if (go == null)
            {
                return;
            }
            go.transform.parent        = transform;
            go.transform.localPosition = Vector3.zero;
            go.transform.localRotation = Quaternion.identity;
            go.transform.localScale    = new Vector3(0.6f, 0.6f, 0.6f);

            UIHeadBar headBar = go.GetComponent <UIHeadBar>();
            if (headBar == null)
            {
                return;
            }
            headBar.UICamera = uiCamera;
            if (MobaMainCamera.MainCamera != null)
            {
                headBar.WorldCamera = MobaMainCamera.MainCamera;
            }
            headBar.Owner = cha;

            if (cha == null || cha.HingePoints == null)
            {
                return;
            }
            Transform hinge = cha.HingePoints.GetHingeName("HeadBar");
            if (hinge == null)
            {
                return;
            }
            headBar.Hinge  = hinge;
            headBar.UIRoot = this;

            cha.headBar = headBar;
        });
    }
Beispiel #2
0
    // Use this for initialization
    void Start()
    {
        GameObject goPlayer = Resources.Load <GameObject>("Player");

        GameObject goHeadBar   = Resources.Load <GameObject>("HeadBar");
        GameObject uiHeadBarGo = GameObject.Instantiate(goHeadBar);

        uiHeadBarGo.transform.localRotation = Quaternion.identity;
        uiHeadBarGo.transform.localPosition = Vector3.zero;
        uiHeadBarGo.transform.localScale    = Vector3.one;

        uiHeadBar = uiHeadBarGo.GetComponent <UIHeadBar>();

        for (int i = 0; i < 1; ++i)
        {
            GameObject pl = GameObject.Instantiate(goPlayer);
            pl.transform.localPosition = Vector3.zero;
            pl.transform.localRotation = Quaternion.identity;
            pl.transform.localScale    = Vector3.one;
            Player player = pl.GetComponent <Player>();
            players.Add(player);
            player.dbid = i;
            uiHeadBar.CreateHeadBar((long)i, "张三对的的", "", "", null, UIHeadBar.ShowType.ePlayerNormal);
            uiHeadBar.SetChengHao(i, "[费大幅度]");
        }
        //[冒险家]
        //[工会名]
        //         GameObject pl = GameObject.Instantiate(goPlayer);
        //         pl.transform.localPosition = Vector3.zero;
        //         pl.transform.localRotation = Quaternion.identity;
        //         pl.transform.localScale = Vector3.one;
        //         Player player = pl.GetComponent<Player>();
        //         players.Add(player);
        //         player.dbid = 100;
        //         uiHeadBar.CreateHeadBar(100, "张三对的的", "[冒险家]", "[工会名]", image);
    }