Пример #1
0
    private void ShowPage()
    {
        aSong_PlayerData propData = this.data != null ? this.data as aSong_PlayerData : aSongUI_Controller.Instance.playerData;

        Debug.Log("propData.props.Count = " + propData.dic_bagProp.Count);
        var   enumerator  = propData.dic_bagProp.GetEnumerator();
        float countWeight = 0;

        //遍历背包,加载道具
        while (enumerator.MoveNext())
        {
            Debug.Log("aSongUI_Backpack::ShowPage id = " + enumerator.Current.Value.prop.name);

            countWeight += enumerator.Current.Value.prop.weight * enumerator.Current.Value.prop.num;
            AddPropToItem(enumerator.Current.Value.prop);
        }
        RefreshBackpackScrow();
        //content.sizeDelta = new Vector2(content.rect.width, propData.dic_bagProp.Count * itemHeight);
        weightText.text = countWeight + "/200";

        if (propData.Guns[0])
        {
            leftWeapon.PutOnWeapon(propData.Guns[0]);
        }
        if (propData.Guns[1])
        {
            rightWeapon.PutOnWeapon(propData.Guns[1]);
        }
    }
Пример #2
0
    //道具还需要根据sort 进行排序. 1.各种类的枪,2.手枪,3.护甲装备,4.血包,6.炸弹......
    //分两种:一种是已经拥有了的,一种是未拥有但是需要的.后一种全排在前一种的前面
    private void ShowPage()
    {
        //Get Skill Data.
        //NOTE:here,maybe you havent Show(...pageData),ofcause you can got your skill data from your data singleton
        b_showed = true;
        this.gameObject.SetActive(true);
        aSong_PlayerData propData = this.data != null ? this.data as aSong_PlayerData : aSongUI_Controller.Instance.playerData;

        Debug.Log("propData.props.Count = " + propData.dic_listProp.Count);


        var enumerator = propData.dic_listProp.GetEnumerator();

        while (enumerator.MoveNext())
        {
            AddPropToItem(enumerator.Current.Value.prop);
        }

        //测试了new 赋值跟 普通赋值所占用时间;基础每个执行都花费3ms, 一万次,new增加了3ms,而赋值因为同一个所以不变
        //Debug.Log("Start = " + DateTime.Now.Millisecond);
        //for(int i = 0; i < 10000; i++)
        content.sizeDelta = new Vector2(content.rect.width, propData.dic_listProp.Count * itemHeight);
        //Debug.Log("Middle = " + DateTime.Now.Millisecond);
        //for (int i = 0; i < 10000; i++)
        b_showed = true;
        //Debug.Log("End = " + DateTime.Now.Millisecond);
    }
Пример #3
0
 private aSongUI_Controller()
 {
     //NOTE : this is Test Init Here.
     jd         = aSong_UnityJsonUtil.Read("AllProps");
     playerData = new aSong_PlayerData();
     playerData.dic_listProp = new Dic_PropModel();
     playerData.dic_bagProp  = new Dic_PropModel();
 }
Пример #4
0
    public override void Refresh()
    {
        base.Refresh();
        Debug.Log("aSongUI_Main::Refresh !!!!!!!!!!!!!!!!!!!!!");

        aSong_PlayerData propData = this.data != null ? this.data as aSong_PlayerData : aSongUI_Controller.Instance.playerData;

        if (propData.Guns[0])
        {
            playerWeapons.GetComponent <aSongUI_PropListItem>().Refresh(propData.Guns[0].prop);
        }
        if (propData.Guns[1])
        {
            playerWeapons_2.GetComponent <aSongUI_PropListItem>().Refresh(propData.Guns[1].prop);
        }
    }