Exemple #1
0
    private void SetCurSelectCrops(CropsShopGridUI target)
    {
        if (null == target)
        {
            return;
        }
        if (null != mOldSelected)
        {
            mOldSelected.SetSelect(false);
        }

        mOldSelected = target;
        mOldSelected.SetSelect(true);

        mPropertyPanel.SetActive(true);
        //设置属性信息
        SetCurSelecteProperty(target.GetCropsId());
        SetCurSelecteStarsLv(target.GetCropsId());
        SetCurSelecteSkill(target.GetCropsId());
        SetCropsBtn(target.GetCropsId());

        NPCTableItem npc = DataManager.NPCTable[target.GetCropsId()] as NPCTableItem;

        if (null == npc)
        {
            return;
        }
        mPreview.SetupCharacter(npc.model, null, -1, uint.MaxValue);
        mPreview.ChangeWeapon(npc.weaponid);
    }
Exemple #2
0
    private void InitCropsShopGridUI(CropsTableItem item)
    {
        PlayerDataModule module = ModuleManager.Instance.FindModule <PlayerDataModule>();

        if (null == module)
        {
            return;
        }
        CropsShopGridUI grid = null;
        GameObject      sp   = null;

        if (!mShopCrid.ContainsKey(item.id))
        {
            sp = WindowManager.Instance.CloneGameObject(mCropsItemPrefab1);
            if (sp == null)
            {
                GameDebug.LogError("mCropsItemPrefab1 prefab not found");
                return;
            }

            sp.SetActive(true);
            sp.name = item.id.ToString();
            grid    = new CropsShopGridUI(sp);
            if (null == grid)
            {
                return;
            }
            grid.SetCropsId(item.id);
            grid.SetIcon(item.picname, item.picname2);
            grid.SetName(item.name);
            grid.SetSelect(false);
            grid.SetStarslv(module.GetCropsStarsLv(item.id));
            grid.SetState(module.GetCropsState(item.id));
            if (module.HasObtainCrops(item.id))
            {
                grid.SetUnlockCrops();
            }
            else
            {
                grid.SetProgress((int)module.GetItemNumByID(item.itemid), item.itemnum);
            }
            grid.onClick            = SetCurSelectCrops;
            sp.transform.parent     = mCampGrid.transform;
            sp.transform.localScale = Vector3.one;
            mCampGrid.Reposition();
            mShopCrid.Add(item.id, grid);
            if (null == mOldSelected || item.id < mOldSelected.GetCropsId())
            {
                mOldSelected = grid;
            }
        }
        else
        {
            grid = mShopCrid[item.id];
            grid.SetStarslv(module.GetCropsStarsLv(item.id));
            grid.SetState(module.GetCropsState(item.id));
            if (!module.HasObtainCrops(item.id))
            {
                grid.SetProgress((int)module.GetItemNumByID(item.itemid), item.itemnum);
            }
            else
            {
                grid.SetUnlockCrops();
            }
        }
    }