コード例 #1
0
    void Init()
    {
        RectTransform rectTran = WndObject.GetComponent <RectTransform>();

        if (rectTran != null)
        {
            rectTran.anchoredPosition = new Vector2((1920f - rectTran.sizeDelta.x) / 2.0f, -(1080f - rectTran.sizeDelta.y) / 2.0f);
        }
        GameObject      obj       = Global.ldaControlX("3DParent", WndObject);
        GameObject      objPlayer = GameObject.Instantiate(Resources.Load("3DUIPlayer")) as GameObject;
        MeteorUnitDebug d         = objPlayer.GetComponent <MeteorUnitDebug>();

        objPlayer.transform.position   = Vector3.zero;
        objPlayer.transform.rotation   = Quaternion.identity;
        objPlayer.transform.localScale = Vector3.one;
        d.gameObject.layer             = obj.gameObject.layer;
        d.Init(0);
        WeaponBase weaponProperty = WeaponMng.Instance.GetItem(MeteorManager.Instance.LocalPlayer.weaponLoader.GetCurrentWeapon().Info().UnitId);

        d.weaponLoader.StrWeaponR = weaponProperty.WeaponR;
        d.weaponLoader.StrWeaponL = weaponProperty.WeaponL;
        d.weaponLoader.EquipWeapon();
        d.transform.SetParent(obj.transform);
        d.transform.localScale    = 8 * Vector3.one;
        d.transform.localPosition = new Vector3(0, 0, -45);
        d.transform.localRotation = Quaternion.identity;
        Global.ldaControlX("Close Button", WndObject).GetComponent <Button>().onClick.AddListener(Close);

        SetStat("Stat Label 1", MeteorManager.Instance.LocalPlayer.Attr.hpCur + "/" + MeteorManager.Instance.LocalPlayer.Attr.HpMax);
        SetStat("Stat Label 2", MeteorManager.Instance.LocalPlayer.AngryValue.ToString());
        SetStat("Stat Label 3", MeteorManager.Instance.LocalPlayer.CalcDamage().ToString());
        SetStat("Stat Label 4", MeteorManager.Instance.LocalPlayer.CalcDef().ToString());
        SetStat("Stat Label 5", MeteorManager.Instance.LocalPlayer.Speed.ToString());
        SetStat("Stat Label 6", string.Format("{0:f2}", MeteorManager.Instance.LocalPlayer.Speed / 1000.0f));

        //处理背包的点击
        UIItemSlot [] slots = Global.ldaControlX("Slots Grid", WndObject).GetComponentsInChildren <UIItemSlot>();
        for (int i = 0; i < slots.Length; i++)
        {
            slots[i].onClick.AddListener(OnClickItem);
        }
    }
コード例 #2
0
 public void NextCharacter()
 {
     Player.Init(U3D.GetNextUnitId(Player.UnitId), LayerMask.NameToLayer("LocalPlayer"), true);
 }