Exemplo n.º 1
0
        public PlayerModelErr BuyProp(string itemId, int num)
        {
            Messenger.Broadcast <CallMethodInfo>(ELocalMsgID.CallPlayerModel, new CallMethodInfo()
            {
                name       = "BuyProp",
                parameters = new object[] { itemId, num },
            });
            GameMainManager.Instance.netManager.BuyItem(itemId, num, (ret, res) => {
            });
            playerData.dirty = true;
            PropItem item = GameMainManager.Instance.configManager.propsConfig.GetItem(itemId);

            if (item == null)
            {
                Debug.Log("物品不存在");
                return(PlayerModelErr.PROP_ID_ERROR);
            }
            int cost = item.price * num;

            if (playerData.coinNum < cost)
            {
                Debug.LogError("金币不足!");
                return(PlayerModelErr.NOT_ENOUGH_COIN);
            }

            playerData.coinNum -= cost;
            playerData.AddPropItem(itemId, num);
            SaveData();
            Messenger.Broadcast(ELocalMsgID.RefreshBaseData);
            return(PlayerModelErr.NULL);
        }
Exemplo n.º 2
0
    public void SetData(PropItem prop, int haveCount, bool isComplate = false)
    {
        string url = FilePathTools.GetPropItemIconPath(prop.icon);

        AssetsManager.Instance.LoadAssetAsync <Sprite>(url, (sp) =>
        {
            img.sprite = sp;
        });
        if (isComplate)
        {
            complateImg.SetActive(true);
            text.text = "";
        }
        else
        {
            complateImg.SetActive(false);
            string str = "";
            if (haveCount < prop.count)
            {
                str = string.Format("<color=red>{0}</color>/{1}", haveCount, prop.count);
            }
            else
            {
                str = haveCount.ToString() + "/" + prop.count.ToString();
            }
            text.text = str;
        }
    }
Exemplo n.º 3
0
    public void refresh()
    {
        PropItem prop  = GameMainManager.Instance.playerData.GetPropItem("200006");
        int      count = prop != null ? prop.count : 0;

        singleAmount.text = count.ToString();
    }
Exemplo n.º 4
0
    public void OnPointerDown(PointerEventData eventData) //按下第一帧
    {
        //根据ID显示信息
        switch (SelfData.iD / 1000)
        {
        case 1:
            WeaponsItem weaItem = SelfData as WeaponsItem;
            ShowData(weaItem.name, new Color(1, 0, 0), weaItem.description, 0, "Attack", weaItem.attack.ToString());
            GameObject.Find("Violent").GetComponent <Text>().text = string.Format("{0:P0}", weaItem.violent);
            break;

        case 2:
            ClothingItem cloItem = SelfData as ClothingItem;
            ShowData(cloItem.name, new Color(1, 1, 0), cloItem.description, 1, "Defense", cloItem.defense.ToString());
            break;

        case 3:
            FoodsItem fooItem = SelfData as FoodsItem;
            ShowData(fooItem.name, new Color(0, 1, 0), fooItem.description, 2, "Cure", fooItem.cure.ToString());
            break;

        case 4:
            PropItem proItem = SelfData as PropItem;
            ShowData(proItem.name, new Color(0, 0, 1), proItem.description, 3, "", "");
            break;
        }
        FrameSwitch();
    }
        private void OnSyncDropActivityResponse(object message)
        {
            MessageHandler.UnRegisterMessageHandler(MessageDefine.SCActivityDropResponse, OnSyncDropActivityResponse);
            SCActivityDropResponse msg = message as SCActivityDropResponse;

            //this.m_imgActivity.TextureName = msg.BackgroundSource;

            bool hasCollectAll = false;

            if (msg.HasReward)
            {
                hasCollectAll = true;
            }
            else
            {
                for (int i = 0; i < msg.Items.Count; ++i)
                {
                    PropItem propItem = msg.Items[i];
                    hasCollectAll = propItem.HasNum >= propItem.Num;
                    if (!hasCollectAll)
                    {
                        break;
                    }
                }
            }

            this.m_lbActivityName.Text = LocalizeModule.Instance.GetString(msg.Name);


            this.m_activityDetailComponent.SetActivityData(msg.Description, msg.Items, msg.SceneId, msg.CollectDes, msg.SceneDes, hasCollectAll);
            this.m_activityReardComponent.SetRewardInfo(this.m_activityInfo.Id, hasCollectAll, msg.Tips, msg.RewardSource);
        }
Exemplo n.º 6
0
    //
    private void addItem(int i, string item)
    {
        var    go   = transform.Find(string.Format("item{0}", i));
        var    b_go = go.transform.Find("Button");
        string i_   = "item";
        string n_   = "num";

        if (i == 7)
        {
            i_ += "1";
            n_ += "1";
        }
        var item_go = b_go.transform.Find(i_);

        item_go.gameObject.SetActive(true);

        string itemId = item.Split(':')[0];
        //GoodsItem goodsItem = DefaultConfig.getInstance().GetConfigByType<item>().GetItemByID(itemId);
        PropItem goodsItem = GameMainManager.Instance.configManager.propsConfig.GetItem(itemId);
        Sprite   sp        = Resources.Load(string.Format("Sprites/UI/{0}", goodsItem.icon), typeof(Sprite)) as Sprite;
        Image    icon      = item_go.GetComponent <Image>();

        icon.sprite = sp;
        icon.SetNativeSize();
        icon.GetComponent <Transform>().localScale = new Vector3(0.3f, 0.3f, 0.3f);
        int itemNum = int.Parse(item.Split(':')[1]);

        if (itemNum > 1)
        {
            var numText = b_go.transform.Find(n_);
            numText.gameObject.SetActive(true);
            numText.GetComponent <Text>().text = "×" + itemNum;
        }
    }
Exemplo n.º 7
0
 public static void UpdatePropItem(PropItem PropTarget, Sprite material1image, Sprite material2image, int material1num, int material2num, string itemDescription)
 {
     instance.currentItem          = PropTarget;
     instance.material1img.sprite  = material1image;
     instance.material2img.sprite  = material2image;
     instance.material1num.text    = material1num.ToString();
     instance.material2num.text    = material2num.ToString();
     instance.itemInformation.text = itemDescription;
 }
Exemplo n.º 8
0
        public void ReduceBasePoint(enmPropType type, int reducePoint = 1)
        {
            PropItem <int> pi = mBasePoints.GetPropItem((int)type);

            if (pi != null)
            {
                pi.SetValue(pi.GetValue() - reducePoint);
            }
        }
Exemplo n.º 9
0
        public void AddBasePoint(enmPropType type, int addPoint = 1)
        {
            PropItem <int> pi = mBasePoints.GetPropItem((int)type);

            if (pi != null)
            {
                pi.SetValue(pi.GetValue() + addPoint);
            }
        }
Exemplo n.º 10
0
        public int GetAdvProp(enmPropType type)
        {
            PropItem <int> pi = mAdvProp.GetPropItem((int)type);

            if (pi != null)
            {
                return(pi.GetValue());
            }
            return(0);
        }
Exemplo n.º 11
0
        public int GetBasePoint(enmPropType type)
        {
            PropItem <int> pi = mBasePoints.GetPropItem((int)type);

            if (pi != null)
            {
                return(pi.GetValue());
            }
            return(0);
        }
Exemplo n.º 12
0
        public int GetClassMod(enmPropType type)
        {
            PropItem <int> pi = mBasePropBonus.GetPropItem((int)type);

            if (pi != null)
            {
                return(pi.GetValue());
            }
            return(0);
        }
Exemplo n.º 13
0
        public int GetRaceMod(enmPropType type)
        {
            PropItem <int> pi = mRaceMod.GetPropItem((int)type);

            if (pi != null)
            {
                return(pi.GetValue());
            }
            return(0);
        }
Exemplo n.º 14
0
        public void Test003()
        {
            var rotateCount = 0;
            var rotateWord  = new Func <string>(() =>
            {
                var wordList = new string[]
                {
                    "トヨタ自動車",
                    "日産自動車",
                    "本田技研",
                    "スバル自動車",

                    "東急電鉄",
                    "東武鉄道",
                    "京成電鉄",
                    "京浜急行電鉄",
                    "相模鉄道",
                    "小田急電鉄",
                    "京王電鉄",
                    "西武鉄道",

                    "日本テレビ",
                    "フジテレビ",
                    "TBS",
                    "テレビ朝日",
                    "テレビ東京",
                };
                rotateCount = (rotateCount + 1) % wordList.Length;

                return(wordList[rotateCount]);
            });

            var props = new Props();

            for (var i = 0; i < 100; i++)
            {
                var sect = new PropSection(String.Format("DEBUG_SECT_{0:000}", i));
                for (var j = 0; j < 500; j++)
                {
                    var item = new PropItem(
                        String.Format("DEBUG_{0:000}-{1:0000}", i, j),
                        PropType.String,
                        rotateWord());
                    sect.Items.Add(item);
                }
                props.Sections.Add(sect);
            }

            using (var fs = File.OpenWrite(".\\QuickTest-Test003.txt"))
                using (var pw = new PropWriter(fs))
                {
                    pw.Write(props);
                }
        }
Exemplo n.º 15
0
    public void SetupSlot(PropItem item)
    {
        if (item == null)
        {
            itemInSlot.SetActive(false);
            return;
        }

        slotImage.sprite = item.itemImage;
        slotItem         = item;
    }
Exemplo n.º 16
0
    public PropItem GetMyItemIDByIndex(int _index)
    {
        PropItem myItemInfo = new PropItem();

        if (_index > m_items.Count - 1)
        {
            return(null);
        }
        myItemInfo.PropID = m_items[_index].PropID;
        myItemInfo.Count  = m_items[_index].Count;
        return(myItemInfo);
    }
Exemplo n.º 17
0
        /// <summary>
        /// アイテム バッファ テーブルを読み込みます。
        /// </summary>
        /// <param name="br"></param>
        /// <param name="completePropInfo">実際のアイテム バッファに付記されているタイプ情報などを読み取るかどうかを指定します。このパラメータはシークが可能な Stream でのみ使用が可能です。</param>
        /// <returns></returns>
        public Dictionary <PropItem, ulong> LoadItemBufferTable(BinaryReader br, bool completePropInfo)
        {
            var st = br.BaseStream;

            if (completePropInfo && st.CanSeek)
            {
                throw new InvalidOperationException("Internal Error");
            }

            // アイテム数の取得
            var itemCount = br.ReadUInt32();

            // アイテム バッファ情報の読み取り

#if DEBUG
            Console.WriteLine("== LOAD ITEM BUFER TABLE ==");
#endif

            var itemBufferTable = new Dictionary <PropItem, ulong>();
            for (var i = 0u; i < itemCount; i++)
            {
                var name = this._readString(br);
                var itemBufferStartOffset = br.ReadUInt64();

#if DEBUG
                Console.WriteLine("{0}={1}", name, itemBufferStartOffset);
#endif

                var item = new PropItem(name, PropType.Buffer, null);
                itemBufferTable.Add(item, itemBufferStartOffset);
            }

            if (!completePropInfo)
            {
                return(itemBufferTable);
            }

            // 各アイテムの詳細情報を取得する
            var itemBufferSectionStartOffset = st.Position; // アイテム バッファ テーブルの終了位置を開始位置とする
            foreach (var elem in itemBufferTable)
            {
                var bufStartOffset = itemBufferSectionStartOffset + (long)elem.Value;
                st.Seek(bufStartOffset, SeekOrigin.Begin);

                // value データ含めて完全にロード
                this.LoadItemBuffer(br, elem.Key, false);
            }

            return(itemBufferTable);
        }
Exemplo n.º 18
0
        public void Test204()
        {
            // UTF-8 でビルダ・ローダを初期化
            var encoding   = Encoding.UTF8;
            var binBuilder = new PropBinaryBuilder(encoding);
            var binLoader  = new PropBinaryLoader(encoding);

            // アイテムの定義
            var propItemName  = "DEBUG_ITEM";
            var propItemType  = PropType.DateTime;
            var propItemValue = new DateTime(1970, 1, 1, 12, 0, 0, 500);
            var propItem      = new PropItem(propItemName, propItemType, propItemValue);

            // アイテム バッファの生成
            var ms = new MemoryStream();

            binBuilder.WriteItemBuffer(ms, propItem, PropItemBufferMode.Buffered);
            ms.Seek(0, SeekOrigin.Begin);

            // 処理実行
            try
            {
                using (var br = new BinaryReader(ms))
                {
                    // アイテム バッファ テーブルから読み取ったと想定するアイテム
                    var loadedItemFromBufferTable = new PropItem(propItemName, PropType.Buffer, null);

                    // フル ロード
                    var loadedItem = binLoader.LoadItemBuffer(br, loadedItemFromBufferTable, false);

                    // アイテム名が正しいことの確認
                    this.TestContext.WriteLine("Name> expected: {0}, actual: {1}", propItemName, loadedItem.Name);
                    Assert.AreEqual(propItemName, loadedItem.Name);

                    // タイプが正しいことの確認
                    this.TestContext.WriteLine("Type> expected: {0}, actual: {1}", propItemType, loadedItem.Type);
                    Assert.AreEqual(propItemType, loadedItem.Type);

                    // 値の内容の確認
                    this.TestContext.WriteLine("Value> expected: {0}, actual: {1}", propItemValue, loadedItem.Value);
                    Assert.AreEqual(propItemValue, loadedItem.Value);
                }
            }
            catch (Exception ex)
            {
                Assert.Fail($"予期せぬエラー: {ex}");
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// アイテム バッファ本体を読み取ります。
        /// </summary>
        /// <param name="br"></param>
        /// <param name="item"></param>
        /// <param name="skipValueData"></param>
        /// <returns></returns>
        public PropItem LoadItemBuffer(BinaryReader br, PropItem item, bool skipValueData)
        {
            var propType   = (PropType)br.ReadUInt16();
            var bufferMode = (PropItemBufferMode)br.ReadByte();

            var result = new PropItem(item.Name, propType, null);

            if (bufferMode == PropItemBufferMode.Null)
            {
                return(result);
            }

            switch (propType)
            {
            case PropType.Int16:
                result.Value = br.ReadInt16();
                break;

            case PropType.Int32:
                result.Value = br.ReadInt32();
                break;

            case PropType.Int64:
                result.Value = br.ReadInt64();
                break;

            case PropType.String:
                result.Value = this._readString(br);
                break;

            case PropType.InversedString:
                result.Value = this._readInversedString(br);
                break;

            case PropType.DateTime:
                result.Value = this._readDateTime(br);
                break;

            case PropType.Guid:
                result.Value = new Guid(br.ReadBytes(Guid.Empty.ToByteArray().Length));
                break;

            default:
                throw new NotImplementedException();
            }

            return(result);
        }
Exemplo n.º 20
0
        protected void btnSubmitItem_Click(object sender, EventArgs e)
        {
            PropItem newitem = new PropItem();

            newitem.Name = txtPopItemName.Text;
            int op = BusinessNewPurchase.busPopItem(newitem);

            if (op <= 0)
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "test2", "<script>window.opener.location.reload(true);window.close();</script>");
            }
            else
            {
                Response.Write("Error in processing.Please Try Again!!");
            }
        }
Exemplo n.º 21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["data"] != null)//session checking
            {
                if (!IsPostBack)
                {
                    PropItem objItem = new PropItem();
                    ddlSearchItemName.DataSource = BusinessNewPurchase.busSelectItem(objItem);
                    ddlSearchItemName.DataBind();

                    PropDestination objDes = new PropDestination();
                    ddlSitename.DataSource = BusinessNewPurchase.busFillDestination(objDes);
                    ddlSitename.DataBind();
                }
            }
        }
Exemplo n.º 22
0
        public void fillItem()
        {
            Itemname = ddlSearchItemName.SelectedItem.Text;
            PropItem prpItem = new PropItem();

            prpItem.Name              = Itemname;
            dsop                      = BusinessSearch.busSearchbyname(prpItem);
            PanelDate.Visible         = false;
            PanelOrder.Visible        = false;
            Panelvendor.Visible       = false;
            Panelcustom.Visible       = false;
            PanelCat.Visible          = false;
            grdvViewResult.DataSource = dsop;
            PanResult.Visible         = true;
            grdvViewResult.DataBind();
        }
Exemplo n.º 23
0
    public void SaleItemToSystem(UInt64 _id, Int32 _count)
    {
        CG_UserSaleToSystem msg = new CG_UserSaleToSystem();

        msg.PlayerID      = MainPlayer.Instance.PlayerInfo.PlayerID;
        msg.SaleItemCount = 1;
        PropItem item = new PropItem();

        item.PropID = _id;
        item.Count  = _count;

        msg.Items = new List <PropItem>();
        msg.Items.Add(item);

        NetManager.Instance.SendMsg(msg);
    }
Exemplo n.º 24
0
    /// <summary>
    /// 在商城界面添加商品
    /// </summary>
    /// <param name="_id">物品ID</param>
    /// <param name="_count">物品数量</param>
    public void AddShoppingcarItemList(UInt64 _id, Int32 _count)
    {
        foreach (PropItem item in m_shoppingcarItem_attr)
        {
            if (item.PropID == _id)
            {
                item.Count += _count;
                return;
            }
        }
        PropItem it = new PropItem();

        it.PropID = _id;
        it.Count  = _count;
        m_shoppingcarItem_attr.Add(it);
        Groot.SignalSystem.FireSignal(Groot.SignalId.ShoppingCar_Update);
    }
Exemplo n.º 25
0
    void Start()
    {
        board = GameObject.Find("Board").GetComponent <Board>();

        singleBooster.SetActive(true);
        PropItem prop = GameMainManager.Instance.playerData.GetPropItem("200006");

        singleAmount.text = prop != null?prop.count.ToString() : "0";

        // single breaker
        //todo:从表里读取
        if (LevelLoader.instance.level < 9)
        {
            m_lockImage.gameObject.SetActive(true);
        }
        Messenger.AddListener(ELocalMsgID.RefreshBaseData, refresh);
    }
Exemplo n.º 26
0
        public int GetLevelById(byte classId)
        {
            if (mClassLevels == null)
            {
                return(0);
            }

            PropReference <int> pr;

            if (mClassLevels.TryGetValue(classId, out pr))
            {
                PropItem <int> pi = pr.GetPropItem();
                if (pi != null)
                {
                    return(pi.GetValue());
                }
            }
            return(0);
        }
Exemplo n.º 27
0
    private void CreatePropItem(PropInfo propInfo, int index, int allCount)
    {
        GameObject item = list.NewItem();

        item.name = "Prop_" + propInfo.config.id;
        PropItem itemCtr = item.GetComponent <PropItem>();

        itemCtr.propInfo            = propInfo;
        itemCtr.toggle.group        = listToggleGroup;
        itemCtr.toggle.interactable = !propInfo.isForbid;
        itemCtr.icon = propInfo.config.icon;
        itemCtr.lockImage.gameObject.SetActive(propInfo.isForbid);

        if (!propInfo.isForbid && propInfo.count > 0)
        {
            //itemCtr.numText.text = "" + propInfo.count;
        }

        item.GetComponent <RectTransform>().anchoredPosition = new Vector2((index - (allCount - 1) / 2) * 200, 10);

        EventTriggerListener.Get(item).onClick = itemCtr.OnSelectChanged;
    }
Exemplo n.º 28
0
    public void SingleBoosterClick()
    {
        if (LevelLoader.instance.level < 9)
        {
            WindowManager.instance.Show <UIAlertPopupWindow>().Init(LanguageManager.instance.GetValueByKey("210134"));
            return;
        }
        if (board.state != GAME_STATE.WAITING_USER_SWAP || board.lockSwap)
        {
            return;
        }

        AudioManager.instance.ButtonClickAudio();

        board.dropTime = 1;

        // check amount
        PropItem prop  = GameMainManager.Instance.playerData.GetPropItem("200006");
        int      count = prop != null ? prop.count : 0;

        if (count <= 0)
        {
            // show booster popup
            ShowPopup(BOOSTER_TYPE.SINGLE_BREAKER);

            return;
        }

        if (board.booster == BOOSTER_TYPE.NONE)
        {
            ActiveBooster(BOOSTER_TYPE.SINGLE_BREAKER);
            GuideManager.instance.Hide();
            GuideManager.instance.Show();
        }
        else
        {
            CancelBooster(BOOSTER_TYPE.SINGLE_BREAKER);
        }
    }
Exemplo n.º 29
0
 public PlayerModelErr QuestComplateCondition()
 {
     config.QuestItem questItem = playerData.GetQuest();
     if (!playerData.complatedQuests.ContainsKey(questItem.id))
     {
         if (playerData.starNum < questItem.requireStar)
         {
             return(PlayerModelErr.NOT_ENOUGH_STAR);
         }
         List <PropItem> needProps = questItem.requireItem;
         foreach (PropItem item in needProps)
         {
             PropItem haveItem  = playerData.GetPropItem(item.id);
             int      haveCount = haveItem == null ? 0 : haveItem.count;
             if (haveCount < item.count)
             {
                 return(PlayerModelErr.NOT_ENOUGH_PROP);
             }
         }
     }
     return(PlayerModelErr.NULL);
 }
Exemplo n.º 30
0
        public PlayerModelErr UseProp(string itemID, int count)
        {
            Messenger.Broadcast <CallMethodInfo>(ELocalMsgID.CallPlayerModel, new CallMethodInfo()
            {
                name       = "UseProp",
                parameters = new object[] { itemID, count },
            });
            GameMainManager.Instance.netManager.UseTools(itemID, count, (ret, res) =>
            {
            });
            playerData.dirty = true;
            PropItem prop = playerData.GetPropItem(itemID);

            if (prop == null || prop.count < count)
            {
                return(PlayerModelErr.NOT_ENOUGH_PROP);
            }

            playerData.RemovePropItem(itemID, count);
            SaveData();
            Messenger.Broadcast(ELocalMsgID.RefreshBaseData);
            return(PlayerModelErr.NULL);
        }