コード例 #1
0
    private void onBtnEnter()
    {
        WeaponSysItemData dt = this.data as WeaponSysItemData;

        if (dt != null)
        {
            dt.TipsPos = this.CacheTrans.position;
        }
        UIMgr.Instance.openUI(UIEnum.weaponSysTips, this.data);
    }
コード例 #2
0
    private void onBtnClick()
    {
        WeaponSysItemData dt = this.data as WeaponSysItemData;

        if (dt != null)
        {
            Message msg = new Message(MsgCmd.On_Change_Weapon, this);
            msg["type"] = dt.Type;
            msg.Send();
        }
    }
コード例 #3
0
    public override void refreshUI()
    {
        WeaponSysItemData dt = this.data as WeaponSysItemData;

        if (dt != null)
        {
            this.CacheTrans.position = dt.TipsPos;
            weaponName.text          = dt.Name;
            baseDamage.text          = dt.BaseDamage.ToString();
            addDamage.text           = dt.AddDamage.ToString();
            costMoney.text           = dt.CostMoney.ToString();
            descText.text            = dt.Desc;
        }
    }
コード例 #4
0
    private void onOpenUI(Message msg)
    {
        if (UIMgr.Instance.isOpen(this.uiEnum))
        {
            UIMgr.Instance.closeUI(this.uiEnum);
            return;
        }

        if (lstInfo != null && lstInfo.Count <= 0)
        {
            List <WeaponInfo> lst = WeaponFactory.Instance.getWeaponInfo();
            for (int i = 0; i < lst.Count; i++)
            {
                WeaponSysItemData dt = new WeaponSysItemData();
                dt.Type       = lst[i].Type;
                dt.CostMoney  = lst[i].CostMoney;
                dt.BaseDamage = lst[i].BaseDamage;
                dt.AddDamage  = lst[i].AddDamage;
                dt.Path       = dt.Type == WeaponType.bow ? lst[i].LeftPath : lst[i].RightPath;
                dt.Name       = lst[i].Name;
                dt.Desc       = lst[i].Desc;
                dt.Scale      = dt.Type == WeaponType.bow ? new Vector3(10, 10, 0.1f) : new Vector3(100, 100, 1);
                lstInfo.Add(dt);
            }
        }
        WeaponSystemData data = new WeaponSystemData();

        data.WeaponInfoLst = lstInfo;

        //BaseEntity player = EntityMgr.Instance.getEntityById(1008611);
        List <BaseEntity> playerLst = EntityMgr.Instance.getEntityByType(EntityType.player);
        BaseEntity        player    = playerLst != null && playerLst.Count > 0 ? playerLst[0] : null;

        if (player != null)
        {
        }
        //canvas的位置旋转
        Vector3    pos = (Vector3)msg["Pos"];
        Quaternion rot = (Quaternion)msg["Rot"];

        UIMgr.Instance.resetCanvasPos(pos, rot);
        this.updateUI(data);
    }
コード例 #5
0
    public override void refreshUI()
    {
        WeaponSysItemData dt = this.data as WeaponSysItemData;

        if (dt != null)
        {
            weaponName.text = dt.Name.ToString();
            weaponCost.text = "售价: " + dt.CostMoney.ToString();
            if (weapon == null)
            {
                //演示在control做处理
                string path = dt.Path;
                ResMgr.Instance.load(path, (obj) =>
                {
                    weapon = obj as GameObject;
                    weapon.transform.SetParent(this.CacheTrans);
                    weapon.transform.position         = new Vector3(this.CacheTrans.position.x, this.CacheTrans.position.y - 1.5f, this.CacheTrans.position.z);
                    weapon.transform.localScale       = dt.Scale;
                    weapon.transform.localEulerAngles = new Vector3(0, 0, 0);
                });
            }
        }
    }