Example #1
0
    void onClick_Btn_nowgain_Btn(GameObject caster)
    {
        MineDataBase db = GameTableManager.Instance.GetTableItem <MineDataBase>(homeDM.StoneID);

        if (db != null)
        {
            int count    = (int)Math.Ceiling((double)homeDM.MineLeftTime / db.immediatelyGainTime);
            int gainTime = (int)homeDM.MineGainTime;
            if (homeDM.IsMineVIP)
            {
                gainTime = (int)homeDM.VipGainTime;
            }
            IncreaseDataBase idb = GameTableManager.Instance.GetTableItem <IncreaseDataBase>(3, gainTime);
            if (idb != null)
            {
                count = (int)Math.Ceiling(count * idb.increase);
            }
            string tips = DataManager.Manager <TextManager>().GetLocalFormatText(114531, count);
            TipsManager.Instance.ShowTipWindow(TipWindowType.CancelOk, tips, () =>
            {
                if (homeDM.HasEnoughDianJuan(count))
                {
                    stImmediMineHomeUserCmd_CS cmd = new stImmediMineHomeUserCmd_CS();
                    cmd.is_vip = homeDM.IsMineVIP;
                    NetService.Instance.Send(cmd);
                }
                else
                {
                    Log.Error("元宝不足");
                }
            });
        }
    }
Example #2
0
    void RefreshUI()
    {
        uint         mineStoneID = homeDM.StoneID;
        ItemDataBase db          = GameTableManager.Instance.GetTableItem <ItemDataBase>(mineStoneID);

        if (db != null)
        {
            m_label_Mine_Name.text  = db.itemName;
            m_label_all_income.text = (homeDM.GainStoneNum * factor).ToString();
            MineDataBase mdb = GameTableManager.Instance.GetTableItem <MineDataBase>(mineStoneID);
            if (mdb != null)
            {
                uint gainTime = mdb.mineGainTime * (uint)factor;

                m_label_reward_time.text = StringUtil.GetStringBySeconds(gainTime);
                ItemDataBase compassData = GameTableManager.Instance.GetTableItem <ItemDataBase>(homeDM.ComPassID);
                if (compassData != null)
                {
                    m_label_name.text = compassData.itemName;
                    string spriteName = string.IsNullOrEmpty(compassData.itemIcon) ? ItemDefine.ICON_NULL : compassData.itemIcon;
                    UIManager.GetTextureAsyn(spriteName, ref m_CASD, () =>
                    {
                        if (null != m__icon)
                        {
                            m__icon.mainTexture = null;
                        }
                    }, m__icon);
                    int count      = DataManager.Manager <ItemManager>().GetItemNumByBaseId(homeDM.ComPassID);
                    int needLuoPan = GameTableManager.Instance.GetGlobalConfig <int>("MineDig", factor.ToString());
                    m_label_num.text = StringUtil.GetNumNeedString(count, needLuoPan);
                }
            }
        }
    }
Example #3
0
        /// <summary>
        /// 通过[矿石道具ID]二分快速查表
        /// </summary>
        /// <param name="dwID">矿石道具ID</param>
        /// <returns></returns>
        public static MineDataBase Query(this List <MineDataBase> sorted, uint dwID)
        {
            var key = new MineDataBase()
            {
                dwID = dwID
            };
            var comparer = new Comparer1();
            var index    = sorted.BinarySearch(key, comparer);

            return(index >= 0 ? sorted[index] : default(MineDataBase));
        }