Example #1
0
 /// <summary>
 /// 绑定临时任务和最终任务信息
 /// </summary>
 /// <param name="item"></param>
 private void GetTempInfo(NDCItem item)
 {
     try
     {
         if (item._mTask.TASKID != 0)
         {
             try
             {
                 AGVMagicUpdate?.Invoke(item._mTask.TASKID, item.CarrierId + "", item.Magic);
                 return;
             }
             catch (Exception e)
             {
                 Console.WriteLine(e.Message);
             }
         }
         if (item._mTask.NDCLOADSITE == null)
         {
             return;
         }
         TempItem tempItem = TempList.Find(c => { return(c.NdcLoadSite == item._mTask.NDCLOADSITE); });
         if (tempItem != null)
         {
             item._mTask.TASKID          = tempItem.TaskID;
             item._mTask.LOADSITE        = tempItem.LoadSite;
             item._mTask.UNLOADSITE      = tempItem.UnloadSite;
             item._mTask.REDIRECTSITE    = tempItem.RedirectSite;
             item._mTask.NDCREDIRECTSITE = tempItem.NdcRedirectSite;
             TempList.Remove(tempItem);
         }
     }catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
 }
Example #2
0
        /// <summary>
        /// 开始一个任务
        /// </summary>
        /// <param name="PrioFromUser">优先级</param>
        /// <param name="IKEYFromUser">ikey值</param>
        /// <param name="DropStationFromUser">卸货地点</param>
        /// <param name="PickStationFromUser">装货地点</param>
        internal void DoStartOrder(TempItem tempItem)
        {
            string        PrioFromUser        = tempItem.Prio;
            string        IKEYFromUser        = tempItem.IKey + "";
            string        PickStationFromUser = tempItem.NdcLoadSite;
            string        DropStationFromUser = tempItem.NdcUnloadSite;
            List <string> StartOrderList      = new List <string>();

            //int Prio, IKEY, DropStation, PickStation;

            bool prio        = int.TryParse(PrioFromUser, out _);
            bool ikey        = int.TryParse(IKEYFromUser, out _);
            bool dropstation = int.TryParse(DropStationFromUser, out _);
            bool pickstation = int.TryParse(PickStationFromUser, out _);

            //if only numbers in textboxes
            if (prio && ikey && dropstation && pickstation)
            {
                StartOrderList.Add(PrioFromUser);
                StartOrderList.Add(IKEYFromUser);
                StartOrderList.Add(DropStationFromUser);
                StartOrderList.Add(PickStationFromUser);

                //Send event
                Q_StartOrder(StartOrderList);
            }
            //Not only numbers in any of the textboxes
            else
            {
                //MessageBox.Show("Wrong data entered");
            }
        }
Example #3
0
            public static string CalculateEQValue()
            {
                if (LocalPlayer.Base == null)
                {
                    return("Not Loaded");
                }
                int value = 0;

                try
                {
                    listToExclude = new List <Item>();
                    equipItemList = LocalPlayer.Base.Profile.Inventory.Equipment.GetAllItems().GetEnumerator();
                    while (equipItemList.MoveNext())
                    {
                        TempItem = equipItemList.Current;
                        value   += TempItem.Template.CreditsPrice;
                        if (TempItem.Template._parent == "5448bf274bdc2dfc2f8b456a")
                        {
                            var x = TempItem.GetAllItems().GetEnumerator();
                            while (x.MoveNext())
                            {
                                value -= x.Current.Template.CreditsPrice;
                            }
                        }
                    }
                    return("Value: " + (value / 1000).ToString() + "|k");
                }
                catch { return("Value: 0"); }
            }
Example #4
0
        void Create(int dataIndex, bool isBottom)
        {
            if (onWillCreateItem == null)
            {
                return;
            }

            LuaBehaviour lb  = onWillCreateItem(this.transform, dataIndex);
            GameObject   obj = lb.gameObject;

            if (obj == null)
            {
                return;
            }
            var item = new TempItem();

            item.go        = obj;
            item.luaTable  = lb.GetSelf();
            item.trans     = obj.GetComponent <RectTransform>();
            item.dataIndex = dataIndex;
            if (isBottom)
            {
                itemList.Add(item);
            }
            else
            {
                item.trans.SetAsFirstSibling();
                itemList.Insert(0, item);
            }
            onInitializeItem(item.luaTable, dataIndex);
        }
Example #5
0
    private void LoadDatabase()
    {
        int    k    = Application.dataPath.LastIndexOf("/");
        string path = Application.dataPath.Substring(0, k) + "/fm.xml";

        List <TempItem> temp = new List <TempItem>();

        SL.Load(ref temp, path);
        foreach (TempItem t in temp)
        {
            allFiles.Add(t.key, t.value);
        }
        temp.Clear();

        if (Application.isEditor)
        {
            string resourcepath = Application.dataPath + @"/Resources/";
            //Get All Files, TO DO Add resource path, strip resource path)
            string[] files = Directory.GetFiles(resourcepath, "*.prefab", SearchOption.AllDirectories);

            //Add new files
            foreach (string s in files)
            {
                string cut = s.Replace(resourcepath, "");
                if (!allFiles.ContainsValue(cut))
                {
                    allFiles.Add(allFiles.Count + 1, cut);
                }
            }

            //Find all files to remove
            List <int> removes = new List <int>();
            foreach (var v in allFiles)
            {
                string uncut = resourcepath + v.Value;
                if (!files.Contains(uncut))
                {
                    removes.Add(v.Key);
                }
            }

            //Remove Files
            foreach (int i in removes)
            {
                allFiles.Remove(i);
            }

            //Save
            foreach (var v in allFiles)
            {
                var t = new TempItem();
                t.key   = v.Key;
                t.value = v.Value;
                temp.Add(t);
            }
            temp.SaveFile(path);
            temp.Clear();
        }
    }
Example #6
0
 public NdcTaskModel(TempItem item)
 {
     IKey         = int.Parse(item.IKey);
     TaskID       = item.TaskID;
     LoadSite     = item.LoadStation;
     UnLoadSite   = item.UnloadStation;
     RedirectSite = item.RedirectUnloadStation;
 }
Example #7
0
 public NdcTaskModel(TempItem item)
 {
     IKey         = item.IKey;
     TaskID       = item.TaskID;
     LoadSite     = item.LoadSite;
     UnLoadSite   = item.UnloadSite;
     RedirectSite = item.RedirectSite;
 }
Example #8
0
        /// <summary>
        /// 添加接货任务
        /// </summary>
        /// <param name="taskid">任务ID </param>
        /// <param name="loadstation">装货区域</param>
        /// <param name="unloadstation">卸货区域</param>
        /// <param name="result">失败原因</param>
        /// <returns></returns>
        public bool AddNDCTask(int taskid, string loadstation, string unloadstation, out string result)
        {
            if (!VCP9412.Instance.IsConnected)
            {
                result = "NDC服务未连接";
                return(false);
            }

            if (!loadStaDic.TryGetValue(loadstation, out string ndcLoadsta))
            {
                result = "装货点未配置";
                return(false);
            }

            if (!unLoadStaDic.TryGetValue(unloadstation, out string ndcUnloadsta))
            {
                result = "卸货点未配置";
                return(false);
            }

            if (Items.Find(c => { return(c._mTask.TASKID == taskid); }) != null)
            {
                result = "找到相同任务ID(" + taskid + ")任务,不能再次添加";
                return(false);
            }

            if (TempList.Find(c => { return(c.TaskID == taskid); }) != null)
            {
                result = "找到相同任务ID(" + taskid + ")任务,不能再次添加";
                return(false);
            }


            TempItem item = new TempItem
            {
                Prio          = "1",
                IKey          = Ikey++,
                TaskID        = taskid,
                LoadSite      = loadstation,
                UnloadSite    = unloadstation,
                NdcLoadSite   = ndcLoadsta,
                NdcUnloadSite = ndcUnloadsta
            };

            TempList.Add(item);
            if (Ikey >= 99)
            {
                Ikey = 1;
            }
            DoStartOrder(item);

            //TaskListUpdate(new NdcTaskModel(item));//更新界面数据

            result = "";
            return(true);
        }
        private COutPacket AddItemPacket(TempItem item, bool owner)
        {
            var p = new COutPacket(SendOps.LP_MiniRoom);

            p.Encode1((byte)MR_Action.TRP_PutItem); // add item opcode
            p.Encode1(owner);
            p.Encode1((byte)item.TargetSlot);
            item.Item.RawEncode(p);

            return(p);
        }
Example #10
0
        public void Add(TempItem item)
        {
            if (item.TargetSlot < 0)
            {
                item.TargetSlot = GetNextSlot();
            }

            if (CanAddToSlot(item.TargetSlot))
            {
                items.Add(item);
            }
        }
Example #11
0
        public IActionResult Update(string id, TempItem tempIn)
        {
            var temp = _tempService.Get(id);

            if (temp == null)
            {
                return(NotFound());
            }

            _tempService.Update(id, tempIn);

            return(NoContent());
        }
Example #12
0
    private void ShowListView()
    {
        XCharacter role = RoleModule.Instance.GetCurPlayer();

        for (int i = 0; i < mTemps.Count; i++)
        {
            TempItem tab = mTemps[i];
            DActor   db  = ReadCfgActor.GetDataById(tab.id);
            GTItemHelper.ShowQualityText(tab.name, db.Name, db.Quality);
            GTItemHelper.ShowActorQuality(tab.quality, db.Id);
            tab.icon.spriteName = db.Icon;
            tab.dress.SetActive(tab.id == role.PetID);
        }
    }
Example #13
0
        public void HandleAddItem(CInPacket p, Character pChar)
        {
            if (dwFirstLockerId == pChar.dwId || !acceptedInvite)
            {
                return;
            }

            var nTI         = (InventoryType)p.Decode1();
            var nCurInvSlot = p.Decode2(); // in inventory
            var nCount      = p.Decode2();
            var nTargetSlot = p.Decode1(); // in trade window

            var pItem = InventoryManipulator.GetItem(pChar, nTI, nCurInvSlot);

            var tempInv = GetTempInv(pChar);

            if (pItem is null || !tempInv.CanAddToSlot(nTargetSlot))
            {
                return;
            }

            if (ItemConstants.is_treat_singly(pItem.nItemID))
            {
                nCount = -1; // negative amount clears the slot
            }
            else
            {
                nCount = Math.Min(pItem.nNumber, Math.Abs(nCount));
            }

            InventoryManipulator.RemoveFrom(pChar, nTI, nCurInvSlot, nCount);

            if (pItem is GW_ItemSlotBundle pBundle && !pBundle.IsRechargeable)
            {
                pItem         = pItem.DeepCopy();
                pItem.nNumber = nCount;
            }

            var pTempItem = new TempItem(pItem, nCurInvSlot, nTargetSlot);

            tempInv.Add(pTempItem);

            Parent.SendPacket(AddItemPacket(pTempItem, !IsOwner(pChar)));
            Partner.SendPacket(AddItemPacket(pTempItem, IsOwner(pChar)));
        }
Example #14
0
        /// <summary>
        ///     Access an item (items are automatically deleted when retrieved)
        /// </summary>
        /// <param name="id">Identifier</param>
        /// <returns>Item or <c>null</c></returns>
        public object this[string id]
        {
            get
            {
                lock (_items)
                {
                    TempItem item;
                    if (!_items.TryGetValue(id, out item))
                    {
                        return(null);
                    }

                    _items.Remove(id);
                    return(item.Value);
                }
            }
            set
            {
                lock (_items)
                    _items[id] = new TempItem(value);
            }
        }
Example #15
0
        /// <summary>
        /// 检查任务状态
        /// </summary>
        /// <param name="status"></param>
        private void CheckStatus(NDCItem item, Message_b b)
        {
            switch (item.Status)
            {
            case 37:     //小车已经分配
                item.CarrierId = b.ParNo;
                break;

            case 3:    //任务完成
                item.IsFinish   = true;
                item.finishTime = DateTime.Now;
                break;

            case 27:    //IKEY in use
                TempItem temp = TempList.Find(c => { return(c.IKey.Equals("" + item._mTask.IKEY)); });
                if (temp != null)
                {
                    temp.IKey = Ikey++;
                    DoStartOrder(temp);
                }
                break;
            }
        }
Example #16
0
    public void AddItem(int itemId)
    {
        bool have = false;

        for (int i = 0; i < itemList.Count; i++)
        {
            if (itemList[i].itemId == itemId)
            {
                itemList[i].itemCount = itemList[i].itemCount + 1;
                have = true;
                break;
            }
        }

        if (!have)
        {
            TempItem item = new TempItem();
            item.itemId    = itemId;
            item.itemCount = 1;
            itemList.Add(item);
            sdUICharacter.Instance.AddLootItem(itemId);
        }
    }
Example #17
0
        private void AutoRun_Click(object sender, EventArgs e)
        {
            if (comboBoxToRun.SelectedIndex == -1)
            {
                MessageBox.Show("You need to pick one.");
            }
            else
            {
                showNumberText = "";
                string TempText = comboBoxToRun.SelectedItem.ToString();
                int    TempItem;
                int.TryParse(TempText, out TempItem);
                if (TempItem == 100 || TempItem == 500 || TempItem == 800)
                {
                    guessGame.PCRunGame(TempItem);
                }

                for (int index = 0; index < 9; index++)
                {
                    int arr1 = (index + 1);
                    showNumberText = showNumberText + guessGame.StatsOfAutoRun[arr1, 0].ToString() + "      --      " + guessGame.StatsOfAutoRun[arr1, 1].ToString() +
                                     " \r\n";
                }
                for (int index = 9; index < 13; index++)
                {
                    int arr1 = (index + 1);
                    showNumberText = showNumberText + guessGame.StatsOfAutoRun[arr1, 0].ToString() + "     --     " + guessGame.StatsOfAutoRun[arr1, 1].ToString() +
                                     " \r\n";
                }

                showNumberText = "With " + TempItem.ToString() + " times gaming\r\n\r\n" + "Average times is " + guessGame.AverageGuessTime.ToString() + "\r\n\r\n" +
                                 "Times      Counts\r\n" + showNumberText;
                Scorelabel.Text = "Score: \n   " + guessGame.GameScore;
                MessageBox.Show(showNumberText);
            }
        }
Example #18
0
 public TempItem Create(TempItem tempIn)
 {
     _tempItem.InsertOne(tempIn);
     return(tempIn);
 }
Example #19
0
        /// <summary>
        /// 重新读取装货点,卸货点对应NDC实际使用信息
        /// </summary>
        public void DoReadSQL()
        {
            try
            {
                NDCSQLControl control = new NDCSQLControl();
                control.ReadWcsNdcSite(out loadStaDic, out unLoadStaDic);

                control.ReadNDCServerAndIKEY(out IPaddress, out Port, out Ikey);

                if (control.ReadUnFinishTask(out List <WCS_NDC_TASK> list))
                {
                    foreach (var i in list)
                    {
                        if (i.ORDERINDEX == 0)
                        {
                            TempItem item = TempList.Find(c => { return(c.TaskID == i.TASKID || c.IKey == i.IKEY); });
                            if (item == null)
                            {
                                TempList.Add(new TempItem()
                                {
                                    TaskID          = i.TASKID,
                                    IKey            = i.IKEY,
                                    LoadSite        = i.LOADSITE,
                                    UnloadSite      = i.UNLOADSITE,
                                    RedirectSite    = i.REDIRECTSITE,
                                    NdcLoadSite     = i.NDCLOADSITE,
                                    NdcUnloadSite   = i.NDCUNLOADSITE,
                                    NdcRedirectSite = i.NDCREDIRECTSITE
                                });
                            }
                        }
                        else
                        {
                            NDCItem item = Items.Find(c =>
                            {
                                return(c._mTask.IKEY == i.IKEY || c._mTask.TASKID == i.TASKID ||
                                       c._mTask.ORDERINDEX == i.ORDERINDEX);
                            });
                            if (item != null)
                            {
                                item._mTask = i;
                            }
                            else
                            {
                                NDCItem it = new NDCItem()
                                {
                                    _mTask = i
                                };
                                Items.Add(it);
                                CheckCanUpdateTaskList(it);
                            }
                        }
                    }

                    control.DelectUnFinishTaskAfter();
                }
            }catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Example #20
0
        /// <summary>
        /// 根据任务ID,重新定位卸货地点
        /// </summary>
        /// <param name="taskid"></param>
        /// <param name="unloadstation"></param>
        /// <returns></returns>
        public bool DoReDerect(int taskid, string unloadstation, out string result, int order = -1)
        {
            NDCItem item = Items.Find(c =>
            {
                return(c._mTask.TASKID == taskid && (order == -1 || c._mTask.ORDERINDEX == order));
            });

            if (item == null)
            {
                TempItem temp = TempList.Find(c => { return(c.TaskID == taskid); });
                if (temp != null)
                {
                    if (unLoadStaDic.TryGetValue(unloadstation, out string ndcUnloadSta))
                    {
                        temp.RedirectSite    = unloadstation;
                        temp.NdcRedirectSite = ndcUnloadSta;
                    }
                    else
                    {
                        result = "该区域的对应关系还没有";
                        return(false);
                    }
                }
                else
                {
                    result = "并未找到任务ID为:" + taskid + "的任务";
                    return(false);
                }
            }
            else
            {
                if (item.DirectStatus == NDCItemStatus.Redirected)
                {
                    result = "任务已经重定位了";
                    return(false);
                }
                else
                {
                    if (unLoadStaDic.TryGetValue(unloadstation, out string ndcUnloadSta))
                    {
                        item._mTask.NDCREDIRECTSITE = ndcUnloadSta;
                        item._mTask.REDIRECTSITE    = unloadstation;
                        if (item.DirectStatus == NDCItemStatus.NeedRedirect)
                        {
                            item.DirectStatus = NDCItemStatus.HasDirectInfo;
                        }
                        else if (item.DirectStatus == NDCItemStatus.CanRedirect || item.DirectStatus == NDCItemStatus.Init)
                        {
                            item.HadDirectInfo = true;
                        }
                    }
                    else
                    {
                        result = "该区域的对应关系还没有";
                        return(false);
                    }
                }
                CheckCanUpdateTaskList(item);
            }

            result = "";
            return(true);
        }
Example #21
0
        public void LoadFromDB()
        {
            using (var conn = new NpgsqlConnection(Constants.DB_World0_ConString))
            {
                conn.Open();

                using (var cmd = new NpgsqlCommand($"SELECT item_id, item_quantity, item_date_expire, item_serial_number, item_cash_serial_number FROM {Constants.DB_All_World_Schema_Name}.char_inventory_items "
                                                   + $"WHERE character_id = {dwOwnerID} "
                                                   + $"AND inventory_slot < {Constants.DB_ITEMSTORAGE_SLOTMAX} "
                                                   + $"AND inventory_slot >= {Constants.DB_ITEMSTORAGE_SLOTMIN}", conn))
                {
                    using (var r = cmd.ExecuteReader())
                    {
                        while (r.Read())
                        {
                            var i = new GW_ItemSlotBundle(Convert.ToInt16(r["item_id"]))
                            {
                                nNumber      = Convert.ToInt16(r["item_quantity"]),
                                tDateExpire  = (DateTime)r["item_date_expire"],
                                liSN         = Convert.ToInt16(r["item_serial_number"]),
                                liCashItemSN = Convert.ToInt16(r["item_cash_serial_number"]),
                            };

                            var tItem = new TempItem(i, 0, 0, 0);

                            Add(tItem);
                        }
                    }
                }

                using (var cmd = new NpgsqlCommand($"SELECT * FROM {Constants.DB_All_World_Schema_Name}.char_inventory_equips "
                                                   + $"WHERE character_id = {dwOwnerID} "
                                                   + $"AND inventory_slot < {Constants.DB_ITEMSTORAGE_SLOTMAX} "
                                                   + $"AND inventory_slot >= {Constants.DB_ITEMSTORAGE_SLOTMIN}", conn))
                    using (var r = cmd.ExecuteReader())
                    {
                        while (r.Read())
                        {
                            //Log.Info("Before adding item...");
                            var e = new GW_ItemSlotEquip(r.GetInt32(2))
                            {
                                dwInvItemId = (int)r.GetInt64(0),
                                // character_id =                   (1),
                                //nItemID = r.GetInt32(2),
                                CurrentUpgradeCount   = (byte)r.GetInt16(3),
                                RemainingUpgradeCount = (byte)r.GetInt16(4),
                                niSTR              = r.GetInt16(5),
                                niDEX              = r.GetInt16(6),
                                niINT              = r.GetInt16(7),
                                niLUK              = r.GetInt16(8),
                                niMaxHP            = r.GetInt16(9),
                                niMaxMP            = r.GetInt16(10),
                                niPAD              = r.GetInt16(11),
                                niMAD              = r.GetInt16(12),
                                niPDD              = r.GetInt16(13),
                                niMDD              = r.GetInt16(14),
                                niACC              = r.GetInt16(15),
                                niEVA              = r.GetInt16(16),
                                niCraft            = r.GetInt16(17),
                                niSpeed            = r.GetInt16(18),
                                niJump             = r.GetInt16(19),
                                nAttribute         = (ItemAttributeFlags)r.GetInt16(20),
                                liSN               = r.GetInt64(21),
                                sTitle             = r["item_title"] as string,
                                nLevelUpType       = (byte)r.GetInt16(23),
                                nLevel             = (byte)r.GetInt16(24),
                                nEXP               = r.GetInt32(25),
                                nDurability        = r.GetInt32(26),
                                HammerUpgradeCount = (byte)r.GetInt32(27),
                                nGrade             = (PotentialGradeCode)r.GetInt16(28),
                                StarUpgradeCount   = (byte)r.GetInt16(29),
                                nOption1           = r.GetInt16(30),
                                nOption2           = r.GetInt16(31),
                                nOption3           = r.GetInt16(32),
                                nSocket1           = r.GetInt16(33),
                                nSocket2           = r.GetInt16(34),
                                liCashItemSN       = r.GetInt64(38),
                                tSealingLock       = (DateTime)r["sealinglock_datetime"],
                                tDateExpire        = (DateTime)r["date_expire"],
                            };

                            //Log.Info($"Adding item ID {r.GetInt32(2)} to slot {r.GetInt16(36)} to char ID {r.GetInt32(1)}/{charId}");

                            var tItem = new TempItem(e, 0, 0, 0);                     // 0's cuz we dont care

                            Add(tItem);
                        }
                    }

                using (var cmd = new NpgsqlCommand($"SELECT merchant_mesos "
                                                   + $"FROM {Constants.DB_All_World_Schema_Name}.characters "
                                                   + $"WHERE id = {dwOwnerID}", conn))
                {
                    using (var r = cmd.ExecuteReader())
                    {
                        while (r.Read())
                        {
                            Meso = r.GetInt64(0);
                            break;
                        }
                    }
                }
            }
        }
Example #22
0
        /// <summary>
        ///
        /// </summary>
        public void Run()
        {
            #region INotifyPropertyChanged

            var t_item = new TempItem();

            t_item.PropertyChanged += (object sender, PropertyChangedEventArgs e) =>
            {
                Console.WriteLine(sender);
                Console.WriteLine(e.PropertyName);
            };

            t_item.id = 1;

            #endregion

            #region 继承、析构执行结果

            var sub = new SubClass();   // 输出结果sub.static\base.static\base.instance\sub.instance

            #endregion

            #region 幻方

            var num_magic_squares_inside = this.NumMagicSquaresInside(new int[][] {
                new int[] { 4, 3, 8, 4 },
                new int[] { 9, 5, 1, 9 },
                new int[] { 2, 7, 6, 2 },
            });
            Console.WriteLine(num_magic_squares_inside);

            #endregion

            #region 进制转换

            var bnum = intToByte(10);
            Console.WriteLine(string.Join("", bnum));
            Console.WriteLine(byteToInt(bnum));

            #endregion

            this.generics();
            this.validLength();
            this.bitOperator();
            this.objCopy();
            this.formatting();
            this.divisionDts();
            this.divisionDts2();
            this.charset();
            this.valueScope();
            this.consoleOut();
            this.dateDiff();
            this.doubleDimensionalArray();
            this.replacePath();
            this.compareVersion();
            this.eachDateTime();
            this.sortedDictionary();
            this.randCode();
            this.md5("escape", Encoding.Default);
            this.other();
            this.xor();
            this.unsafeFib();
        }
Example #23
0
        public ActionResult <TempItem> Create(TempItem temp)
        {
            _tempService.Create(temp);

            return(CreatedAtRoute("GetTemp", new { id = temp.Id.ToString() }, temp));
        }
Example #24
0
        private void CompleteItem()
        {
            bool result = TempItem.CompleteToggle();

            contentDirty = true;
        }
Example #25
0
    private void InitItems()
    {
        Dictionary <int, DActor> dict = new Dictionary <int, DActor>();

        foreach (var current in ReadCfgActor.Dict)
        {
            if (current.Value.Type == EActorType.PET)
            {
                dict[current.Key] = current.Value;
            }
        }

        Dictionary <int, DActor> .Enumerator em = dict.GetEnumerator();
        int group = GTWindowManager.Instance.GetToggleGroupId();
        int num   = 0;

        while (em.MoveNext())
        {
            GameObject go = NGUITools.AddChild(leftGrid.gameObject, leftTemp);
            leftGrid.AddChild(go.transform);
            go.SetActive(true);

            int id = em.Current.Value.Id;
            go.name = id.ToString();

            TempItem tab = new TempItem();
            tab.id      = id;
            tab.btn     = go;
            tab.toggle  = go.GetComponent <UIToggle>();
            tab.icon    = go.transform.Find("Icon").GetComponent <UISprite>();
            tab.name    = go.transform.Find("Name").GetComponent <UILabel>();
            tab.dress   = go.transform.Find("Dress").gameObject;
            tab.quality = go.transform.Find("Quality").GetComponent <UISprite>();
            mTemps.Add(tab);

            num++;
            if (num == 1)
            {
                tab.toggle.value = true;
                mCurPetID        = em.Current.Value.Id;
            }

            int index = num;

            UIEventListener.Get(go).onClick = delegate(GameObject obj)
            {
                GTAudioManager.Instance.PlayEffectAudio(GTAudioKey.SOUND_UI_CLICK);
                if (index > 2 && index < dict.Count - 2)
                {
                    leftCenterOnChild.enabled = true;
                    leftCenterOnChild.CenterOn(go.transform);
                    leftCenterOnChild.onCenter = delegate(GameObject centerObj)
                    {
                        leftCenterOnChild.enabled = false;
                    };
                }
                Switch(id);
            };
        }
        em.Dispose();
        leftGrid.repositionNow = true;
    }
Example #26
0
 public void Update(string id, TempItem tempIn) =>
 _tempItem.ReplaceOne(tempItem => tempItem.Id == id, tempIn);
Example #27
0
 public void Remove(TempItem tempIn) =>
 _tempItem.DeleteOne(tempItem => tempItem.Id == tempIn.Id);
Example #28
0
    /// <summary>
    /// 关闭对象,返还给对象池默认可以存5个对象
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="ctrl"></param>
    /// <param name="objCount"></param>
    public void DisappearObjectToPool(ObjectPoolSingle type, GameObject obj, bool isTempObj)
    {
        long storeTime = CGameTime.Instance.GetTimeStamp();

        if (!isTempObj)
        {
            if (!EnumIndexObjectDic.ContainsKey(type))
            {
                EnumIndexObjectDic.Add(type, new List <GameObject>());
                des_Queue.Add(type, new List <GameObject>());
            }

            if (obj == null)
            {
                Debug.LogError("exist null pool obj!");
            }
            //对象返回池子

            obj.SetActive(false);
            obj.transform.SetParent(this.transform, false);
            //防止点快了
            bool canAddToPool = true;
            foreach (GameObject existObj in EnumIndexObjectDic[type])
            {
                if (existObj.GetInstanceID() == obj.GetInstanceID())
                {
                    canAddToPool = false;
                    break;
                }
            }
            if (canAddToPool)
            {
                EnumIndexObjectDic[type].Add(obj);
            }
        }
        else
        {
            if (!tempEnumIndexObjectDic.ContainsKey(type))
            {
                tempEnumIndexObjectDic.Add(type, new List <TempItem>());
                tempDes_Queue.Add(type, new List <TempItem>());
            }

            if (obj == null)
            {
                Debug.LogError("exist null pool obj!");
            }
            //对象返回池子

            obj.SetActive(false);
            obj.transform.SetParent(this.transform, false);
            //防止点快了
            bool canAddToPool = true;
            foreach (TempItem existTemp in tempEnumIndexObjectDic[type])
            {
                if (existTemp.obj.GetInstanceID() == obj.GetInstanceID())
                {
                    canAddToPool = false;
                    break;
                }
            }
            if (canAddToPool)
            {
                TempItem tempItem = new TempItem();
                tempItem.obj       = obj;
                tempItem.storeTime = storeTime;
                tempEnumIndexObjectDic[type].Add(tempItem);
            }
        }
    }