Пример #1
0
    static int get_typeid(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            ItemTableItem obj = (ItemTableItem)o;
            int           ret = obj.typeid;
            LuaDLL.lua_pushinteger(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index typeid on a nil value"));
        }
    }
Пример #2
0
 public void SetResID(int resId)
 {
     mItemID  = resId;
     mItemRes = ItemManager.GetItemRes(mItemID);
     if (mItemRes != null)
     {
         SetIcon(mItemRes.picname);
         SetParam1(mItemRes.picname2);
         SetParam2(mItemRes.picname3);
     }
     else
     {
         SetIcon(null);
         SetParam1(null);
         SetParam2("");
     }
 }
Пример #3
0
    static int get_icon(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            ItemTableItem obj = (ItemTableItem)o;
            string        ret = obj.icon;
            LuaDLL.lua_pushstring(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index icon on a nil value"));
        }
    }
Пример #4
0
    static int set_typeid(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            ItemTableItem obj  = (ItemTableItem)o;
            int           arg0 = (int)LuaDLL.luaL_checkinteger(L, 2);
            obj.typeid = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index typeid on a nil value"));
        }
    }
Пример #5
0
    static int set_icon(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            ItemTableItem obj  = (ItemTableItem)o;
            string        arg0 = ToLua.CheckString(L, 2);
            obj.icon = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index icon on a nil value"));
        }
    }
Пример #6
0
    private void Refresh()
    {
        int itemNum = mModule.GetSweepItemNum();
        int needNum = ConfigManager.GetChallengeSweepNeedItemNum();

        if (itemNum < needNum)
        {
            ItemTableItem itemRes = ItemManager.GetItemRes(ConfigManager.GetChallengeSweepNeedItemResID());
            needMoney          = itemRes.gameprice * (needNum - itemNum);
            mItemNumLabel.text = StringHelper.GetString("money_game") + "x" + needMoney;
            yestLabel.text     = "购买并使用";
            state = 0;
        }
        else
        {
            mItemNumLabel.text = string.Format(StringHelper.GetString("item_num"), itemNum, mModule.GetItemName());
            yestLabel.text     = "使  用";
            state = 1;
        }
        Tip.text = String.Format(StringHelper.GetString("fastFinish"), (mModule.GetHistoryFloor() + 1));
    }
Пример #7
0
    public void SetData(TotalChargeItemItem item)
    {
        if (item == null)
        {
            setNull();

            return;
        }

        ItemTableItem itemitem = ItemManager.GetItemRes(item.itemid);

        if (itemitem == null)
        {
            setNull();
            return;
        }

        UIAtlasHelper.SetSpriteImage(mIcon, itemitem.picname, true);
        mCount.text = item.itemNum.ToString();
        mName.text  = ItemManager.getItemNameWithColor(item.itemid);
    }
Пример #8
0
    static int _CreateItemTableItem(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                ItemTableItem obj = new ItemTableItem();
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: ItemTableItem.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Пример #9
0
    public static string getItemNameWithColor(int resId)
    {
        ItemTableItem itemRes = ItemManager.GetItemRes(resId);

        if (itemRes == null)
        {
            return(null);
        }

        if (!DataManager.ConfigTable.ContainsKey(itemRes.quality))
        {
            return(itemRes.name);
        }

        ConfigTableItem item = DataManager.ConfigTable[itemRes.quality] as ConfigTableItem;

        if (item == null)
        {
            return(itemRes.name);
        }

        return("[" + item.value + "]" + itemRes.name + "[-]");
    }
Пример #10
0
    private void OnWingUpdate(EventBase e)
    {
        WingModule module = ModuleManager.Instance.FindModule <WingModule>();
        List <int> list   = module.GetUnlockWing();

        for (int i = 0; i < msMaxWingNum; ++i)
        {
            if (i < list.Count)
            {
                mWingObject[i].SetActive(true);
                WingCommonTableItem commonRes = DataManager.WingCommonTable[list[i]] as WingCommonTableItem;
                if (commonRes != null)
                {
                    ItemTableItem itemRes = ItemManager.GetItemRes(commonRes.costId);
                    if (itemRes != null)
                    {
                        UIAtlasHelper.SetSpriteImage(mWingIcon[i], itemRes.picname);
                        uint wingLevel = module.GetWingLevel(list[i]);
                        if (wingLevel > 0)
                        {
                            mWingLevel[i].gameObject.SetActive(true);
                            mWingLevel[i].text = "Lv " + wingLevel;
                        }
                        else
                        {
                            mWingLevel[i].gameObject.SetActive(false);
                        }
                    }
                }
            }
            else
            {
                mWingObject[i].SetActive(false);
                UIAtlasHelper.SetSpriteImage(mWingIcon[i], null);
            }
        }
    }
Пример #11
0
    private void InitNormalItemInfo()
    {
        ItemTableItem item = ItemManager.GetItemRes(uiparam.itemid); //DataManager.NormalItemTable[uiparam.itemid] as NormalItemTableItem;

        if (null == item)
        {
            return;
        }
        ConfigTableItem configitem = DataManager.ConfigTable[item.quality] as ConfigTableItem;

        if (null == configitem)
        {
            return;
        }
        mItemName.text   = "[" + configitem.value + "]" + item.name;
        mItemType.text   = "物品类型";
        mItemUseLv.text  = item.desc1;
        mItemDesc.text   = item.desc;
        mItemAbtain.text = item.desc0;
        mSaleMoney.text  = item.gameprice.ToString();
        SetIcon(mItemPic, item.picname);
        SetIcon(mItemPic1, item.picname2);
        mItemLb.text = item.picname3;
    }
Пример #12
0
 private void OnWingUpdate()
 {
     for (int i = 0; i < msMaxWingNum; ++i)
     {
         if (i < mOtherData.mWingData.wingItems.Count)
         {
             mWingObject[i].SetActive(true);
             WingCommonTableItem commonRes = DataManager.WingCommonTable[mOtherData.mWingData.wingItems[i].id] as WingCommonTableItem;
             if (commonRes != null)
             {
                 ItemTableItem itemRes = ItemManager.GetItemRes(commonRes.costId);
                 if (itemRes != null)
                 {
                     UIAtlasHelper.SetSpriteImage(mWingIcon[i], itemRes.picname);
                 }
             }
         }
         else
         {
             mWingObject[i].SetActive(false);
             UIAtlasHelper.SetSpriteImage(mWingIcon[i], null);
         }
     }
 }
Пример #13
0
    public override void HpDamageAward(uint objtarget, int time)
    {
        if (mRes == null)
        {
            return;
        }

        if (uint.MaxValue == objtarget)
        {
            return;
        }

        if (0 == cdTime)
        {
            cdTime = time * 1000;
        }
        else
        {
            return;
        }

        // 掉货币
        if (mRes.dropMoney > 0 && mRes.dropMoneyWeight > 0)
        {
            int rand = Random.Range(0, DropManager.MAX_WEIGHT);
            if (mRes.dropMoneyWeight > rand)
            {
                List <PickInitParam> paramList = new List <PickInitParam>();
                if (SceneObjManager.CreatePickInitParam(Pick.PickType.MONEY, mRes.dropMoneyPickId, mRes.dropMoney, GetPosition(), GetDirection(), out paramList, true, Pick.FlyType.FLY_OUT, false))
                {
                    foreach (PickInitParam param in paramList)
                    {
                        mScene.CreateSprite(param);
                    }
                }
            }
        }

        // 掉buff
        if (mRes.buffDropBoxId >= 0)
        {
            List <PickInitParam> paramList = new List <PickInitParam>();
            if (SceneObjManager.CreatePickInitParam(Pick.PickType.BUFF, -1, mRes.buffDropBoxId, GetPosition(), GetDirection(), out paramList, true, Pick.FlyType.FLY_OUT, true))
            {
                foreach (PickInitParam param in paramList)
                {
                    mScene.CreateSprite(param);
                }
            }
        }

        // 掉道具
        if (mRes.itemDropBoxId >= 0)
        {
            if (mRes.isDropOnGround > 0)
            {            // 掉地上
                List <PickInitParam> paramList = new List <PickInitParam>();
                if (SceneObjManager.CreatePickInitParam(Pick.PickType.ITEM, -1, mRes.itemDropBoxId, GetPosition(), GetDirection(), out paramList, true, Pick.FlyType.FLY_OUT, true))
                {
                    foreach (PickInitParam param in paramList)
                    {
                        mScene.CreateSprite(param);
                    }
                }
            }
            else
            {
                ArrayList itemList = new ArrayList();
                if (DropManager.Instance.GenerateDropBox(mRes.itemDropBoxId, out itemList))
                {
                    foreach (DropBoxItem item in itemList)
                    {
                        ItemTableItem itemres = ItemManager.GetItemRes(item.itemid);
                        if (itemres == null)
                        {
                            continue;
                        }

                        ObjectBase obj = PlayerController.Instance.GetControlObj();
                        if (obj != null)
                        {
                            PlayerDataModule pdm = ModuleManager.Instance.FindModule <PlayerDataModule>();
                            if (pdm != null)
                            {
                                //pdm.CreateItemUnreal(item.itemid, PackageType.Pack_Bag);
                            }
                        }
                    }
                }
            }
        }
    }
Пример #14
0
    void OpenBuyForm(int resId)
    {
        PlayerDataModule playerModule = ModuleManager.Instance.FindModule <PlayerDataModule>();

        if (playerModule == null)
        {
            GameDebug.LogError("player data is null!");
            return;
        }

        if (!Module.MallTable.ContainsKey(resId))
        {
            return;
        }

        MallTableItem item = Module.MallTable[resId] as MallTableItem;
        //EventDelegate.Add(gBuyBtn.onClick, OnBuyClick);

        ItemTableItem tableItem = ItemManager.GetItemRes(item.itemId);

        if (tableItem == null)
        {
#if UNITY_EDITOR
            GameDebug.LogError("物品表中缺少ID为" + item.itemId + "的物品");
#endif
            return;
        }

        if (!mAllItemsLists.ContainsKey(resId))
        {
            return;
        }

        MallItemUI itemUI = mAllItemsLists[resId] as MallItemUI;
        if (itemUI == null || !itemUI.MallCanOpenBuyForm)
        {
            return;
        }

        //gNameLb.text = tableItem.name;
        gNameLb.text       = ItemManager.getItemNameWithColor(item.itemId);
        gItemDetailLb.text = tableItem.desc;
        gGetDetailLb.text  = tableItem.desc0;
        UIAtlasHelper.SetSpriteImage(gIconSp, tableItem.picname, true);
        UIAtlasHelper.SetSpriteByMoneyType(gMoneySp, (ProceedsType)item.processType);
        gMoneySp.transform.localScale = new Vector3(0.5f, 0.5f, 1f);

        uint moneyNum = item.mallItems[0].processNow;
        if (playerModule.GetProceeds((ProceedsType)item.processType) < moneyNum)
        {
            gMoneyLb.text = StringHelper.StringWithColor(FontColor.Red, moneyNum.ToString());
        }
        else
        {
            gMoneyLb.text = moneyNum.ToString();
        }

        gItemTypeLb.text = ItemManager.GetItemTypeStr(item.itemId);

        gBuyObj.SetActive(true);
    }
Пример #15
0
    // 生成掉落物
    public static bool CreatePickInitParam(Pick.PickType picktype, int resid, int content, Vector3 pos, float dir, out List <PickInitParam> paramList, bool randomPos = false, Pick.FlyType flytype = Pick.FlyType.FLY_OUT, bool isDropBoxId = true)
    {
        paramList = new List <PickInitParam>();

        if (content < 0)
        {
            return(false);
        }

        if (picktype <= Pick.PickType.INVALID || picktype >= Pick.PickType.TYPE_COUNT)
        {
            return(false);
        }

        if (isDropBoxId)
        {
            ArrayList buffList = new ArrayList();
            if (DropManager.Instance.GenerateDropBox(content, out buffList))
            {
                foreach (DropBoxItem item in buffList)
                {
                    int pickres_id = item.itemid;

                    if (picktype == Pick.PickType.ITEM)
                    {
                        ItemTableItem itemres = ItemManager.GetItemRes(item.itemid);
                        if (itemres == null)
                        {
                            continue;
                        }

                        pickres_id = itemres.pickId;
                    }

                    for (int i = 0; i < item.itemnum; ++i)
                    {
                        PickInitParam initParam = new PickInitParam();
                        initParam.pick_type   = picktype;
                        initParam.pick_res_id = pickres_id;
                        initParam.init_dir    = dir;
                        initParam.init_pos    = pos;
                        initParam.random_pos  = randomPos;
                        initParam.fly_type    = flytype;

                        paramList.Add(initParam);
                    }
                }
            }
        }
        else
        {
            int pickres_id = resid;

            if (picktype == Pick.PickType.MONEY)
            {
                if (content < 1)
                {
                    return(false);
                }
            }
            else if (picktype == Pick.PickType.SUPER_WEAPON)
            {
                if (!DataManager.SuperWeaponTable.ContainsKey(content))
                {
                    GameDebug.LogError("没找到超级武器 id = " + content.ToString());
                    return(false);
                }
            }
            else if (picktype == Pick.PickType.ITEM)
            {
                ItemTableItem itemres = ItemManager.GetItemRes(content);
                if (itemres == null)
                {
                    return(false);
                }

                pickres_id = itemres.pickId;
            }

            PickInitParam initParam = new PickInitParam();
            initParam.pick_type   = picktype;
            initParam.pick_res_id = pickres_id;
            initParam.content     = content;
            initParam.init_dir    = dir;
            initParam.init_pos    = pos;
            initParam.random_pos  = randomPos;
            initParam.fly_type    = flytype;

            paramList.Add(initParam);
        }

        return(true);
    }
Пример #16
0
    void OpenBuyForm(int resId)
    {
        if (!DataManager.ShopTable.ContainsKey(resId))
        {
            return;
        }

        if (!mAllItemsLists.ContainsKey(resId))
        {
            return;
        }

        ShopItemUI itemUi = mAllItemsLists[resId];

        if (itemUi == null || itemUi.IsScretItemBuyDone)
        {
            return;
        }

        ShopTableItem item = DataManager.ShopTable[resId] as ShopTableItem;

        ItemTableItem tableItem = ItemManager.GetItemRes(item.itemId);

        if (tableItem == null)
        {
#if UNITY_EDITOR
            GameDebug.LogError("物品表中缺少ID为" + item.itemId + "的物品");
#endif
            return;
        }

        //gNameLb.text = tableItem.name;
        gNameLb.text       = ItemManager.getItemNameWithColor(item.itemId);
        gItemDetailLb.text = tableItem.desc;
        gGetDetailLb.text  = tableItem.desc0;
        UIAtlasHelper.SetSpriteImage(gIconSp, tableItem.picname, true);
        gItemTypeLb.text = ItemManager.GetItemTypeStr(item.itemId);

        ProceedsType pt   = ProceedsType.Invalid;
        int          cost = 0;

        if (!itemUi.GetProcTypeAndCost(ref pt, ref cost))
        {
            return;
        }

        UIAtlasHelper.SetSpriteByMoneyType(gMoneySp, pt);
        gMoneySp.transform.localScale = new Vector3(0.5f, 0.5f, 1f);

        PlayerDataModule playerModule = ModuleManager.Instance.FindModule <PlayerDataModule>();
        if (playerModule == null)
        {
            GameDebug.LogError("player data is null!");
            return;
        }

        if (playerModule.GetProceeds(pt) < cost)
        {
            gMoneyLb.text = StringHelper.StringWithColor(FontColor.Red, cost.ToString());
        }
        else
        {
            gMoneyLb.text = cost.ToString();
        }

        gBuyObj.SetActive(true);
    }
Пример #17
0
    public void SetData(MallTableItem node)
    {
        if (node == null)
        {
            SetName("");

            huiSp.gameObject.SetActive(true);
            nullLb.gameObject.SetActive(true);

            icon.gameObject.SetActive(false);
            moneyLb.gameObject.SetActive(false);
            moneySp.gameObject.SetActive(false);
            countLb.gameObject.SetActive(false);
            discountSp.gameObject.SetActive(false);
            discountLb.gameObject.SetActive(false);
            effectSp.gameObject.SetActive(false);
            orignalPriceLb.gameObject.SetActive(false);
            orignalPriceSp.gameObject.SetActive(false);
            limitTimesLb.gameObject.SetActive(false);
            limitTimesSp.gameObject.SetActive(false);

            return;
        }

        ItemTableItem itemItem = ItemManager.GetItemRes(node.itemId);

        if (itemItem == null)
        {
            Debug.LogError("找不到物品id" + node.itemId + "对应的物品");
            return;
        }
        //SetName(itemItem.name);
        SetName(ItemManager.getItemNameWithColor(node.itemId));
        SetIcon(itemItem.picname);
        SetMoneyType((ProceedsType)node.processType);

        uint priceOrig = node.mallItems[0].processOrignal;
        uint priceNow  = node.mallItems[0].processNow;

        curPrice = priceNow;

        SetOrignalPrice(priceOrig);
        SetCurPrice(priceNow);

        totalTimes = node.limitTimes;
        switch ((MallLimitType)node.limitType)
        {
        case MallLimitType.NONE:
            limitTimesLb.gameObject.SetActive(false);
            limitTimesSp.gameObject.SetActive(false);
            break;

        case MallLimitType.DAY:
        case MallLimitType.FOREVER:
            limitTimesLb.gameObject.SetActive(true);
            limitTimesSp.gameObject.SetActive(true);
            break;
        }
        countLb.text = "x" + node.mallItems[0].count.ToString();
        int saleNum = (int)((float)priceNow / (float)priceOrig * 10f);

        discountLb.text = saleNum + "折";

        bool isShow = priceNow < priceOrig;

        discountSp.gameObject.SetActive(isShow);
        discountLb.gameObject.SetActive(isShow);
        effectSp.gameObject.SetActive(isShow);
        orignalPriceLb.gameObject.SetActive(false);
        orignalPriceSp.gameObject.SetActive(false);
        nullLb.gameObject.SetActive(false);
    }
Пример #18
0
 public void AddItem(ItemTableItem item)
 {
     items.Add(item);
 }
Пример #19
0
    public void SetData(ShopTableItem node)
    {
        if (node == null)
        {
            resId = -1;
            mitem = null;

            SetName("");

            huiSp.gameObject.SetActive(true);
            nullLb.gameObject.SetActive(true);

            icon.gameObject.SetActive(false);
            moneyLb.gameObject.SetActive(false);
            moneySp.gameObject.SetActive(false);
            countLb.gameObject.SetActive(false);
            discountSp.gameObject.SetActive(false);
            discountLb.gameObject.SetActive(false);
            effectSp.gameObject.SetActive(false);
            orignalPriceLb.gameObject.SetActive(false);
            orignalPriceSp.gameObject.SetActive(false);
            limitTimesLb.gameObject.SetActive(false);
            limitTimesSp.gameObject.SetActive(false);

            return;
        }

        ItemTableItem itemItem = ItemManager.GetItemRes(node.itemId);

        if (itemItem == null)
        {
            Debug.LogError("找不到物品id" + node.itemId + "对应的物品");
            return;
        }

        resId = node.resId;
        mitem = node;

        SetName(ItemManager.getItemNameWithColor(node.itemId));
        SetIcon(itemItem.picname);

        if (node.subTable != (int)ShopSubTable.Sceret)
        {
            uint count = node.minCount * node.multiple;

            mPt   = (ProceedsType)(node.proceedType0);
            mCost = (uint)node.perPrice0 * count;

            //UIAtlasHelper.SetSpriteByMoneyType(moneySp, mPt);
            SetMoneyType(mPt);
            SetCurPrice(mCost);
            countLb.text = "x" + count;

            mInfo = new ShopItemInfo();
            mInfo.proceedsTypeIdx = 0;
            mInfo.isBuyDone       = false;
            mInfo.count           = (int)node.minCount;
        }
        nullLb.gameObject.SetActive(false);
        huiSp.gameObject.SetActive(false);
        discountSp.gameObject.SetActive(false);
        discountLb.gameObject.SetActive(false);
        effectSp.gameObject.SetActive(false);
        orignalPriceLb.gameObject.SetActive(false);
        orignalPriceSp.gameObject.SetActive(false);
        limitTimesLb.gameObject.SetActive(false);
        limitTimesSp.gameObject.SetActive(false);
    }