Ejemplo n.º 1
0
                } // end DoBeforeEntering

                private void OnSelectedGrid(int id) {
                    string itemID = blueprintPack.GetItemIDForGrid(id);
                    IBluePrintInfo info = Configs.itemConfig.GetItemInfo(itemID) as IBluePrintInfo;
                    if (null == info) return;
                    // end if
                    printInfo = info;
                    buleprint.SetUIItem(ResourcesTool.LoadSprite(info.spritepath), 0);
                    int number = info.stuffNumber;
                    int x = (number - 1) * 40;
                    for (int i = 0; i < stuffArray.Length; i++) {
                        if (i < number) {
                            string stuffID = "";
                            if (false == info.TryGetStuffID(i, out stuffID)) continue;
                            // end if
                            IItemInfo stuff = Configs.itemConfig.GetItemInfo(stuffID);
                            if (null == stuff) continue;
                            // end if
                            int stuffCount = 0;
                            if (false == info.TryGetStuffCount(i, out stuffCount)) continue;
                            // end if
                            stuffArray[i].transform.localPosition = new Vector3((x - 80 * i), 0, 0);
                            stuffArray[i].gameObject.SetActive(true);
                            int numerator = SceneManager.mainCharacter.pack.GetItemPack(ConstConfig.STUFF).GetCountForID(stuff.id);
                            stuffArray[i].SetUIItem(ResourcesTool.LoadSprite(stuff.spritepath), 0);
                            stuffArray[i].item.SetPercent(numerator, stuffCount);
                            continue;
                        } // end if
                        stuffArray[i].gameObject.SetActive(false);
                    } // end for
                } // end OnSelectedGrid
Ejemplo n.º 2
0
                } // end UISettingPanel

                public void DoBeforeEntering() {
                    stuffArray = new UICell[4];
                    cellArray = new UICell[ConstConfig.GRID_COUNT];
                    blueprintPack = SceneManager.mainCharacter.pack.GetItemPack(ConstConfig.PRINT);
                    gameObject = ObjectTool.InstantiateGo("ForgePanelUI", ResourcesTool.LoadPrefabUI(id), SceneManager.mainCanvas.rectTransform);
                    rectTransform = gameObject.GetComponent<RectTransform>();
                    rectTransform.sizeDelta = SceneManager.mainCanvas.sizeDelta;
                    buleprint = rectTransform.Find("Blueprint/Print").gameObject.AddComponent<UICell>();
                    for (int i = 0; i < cellArray.Length; i++) {
                        cellArray[i] = rectTransform.Find("GridPanel/Grids/Grid_" + i).gameObject.AddComponent<UICell>();
                        string itemID = blueprintPack.GetItemIDForGrid(i);
                        IItemInfo info = Configs.itemConfig.GetItemInfo(itemID);
                        if (null == info) {
                            cellArray[i].HideItem();
                            continue;
                        } // end 
                        int id = i;
                        cellArray[i].AddAction(delegate () { OnSelectedGrid(id); });
                        cellArray[i].SetUIItem(ResourcesTool.LoadSprite(info.spritepath), 0);
                    } // end for
                    for (int i = 0; i < stuffArray.Length; i++) {
                        stuffArray[i] = rectTransform.Find("Blueprint/Stuff_" + i).gameObject.AddComponent<UICell>();
                        stuffArray[i].gameObject.SetActive(false);
                    } // end for
                    rectTransform.Find("ForgeBtn").gameObject.AddComponent<UIButtonNormal>().AddListener(delegate () { OnClickForgeBtn(); });
                    rectTransform.Find("CloseBtn").gameObject.AddComponent<UIButtonNormal>().AddListener(delegate () { OnClickCloseBtn(); }, "ui_close");
                } // end DoBeforeEntering
Ejemplo n.º 3
0
                } // end OnExchangeGrid

                private void OnSelectedGrid(int id) {
                    string itemID = currentPack.GetItemIDForGrid(id);
                    IItemInfo info = Configs.itemConfig.GetItemInfo(itemID);
                    if (null != info) {
                        currentGid = id;
                        infoText.text = info.ToString();
                    } else {
                        LoseItem();
                    }// end if
                } // end OnSelectedGrid
Ejemplo n.º 4
0
                } // end LoseItem

                private void SwitchPack(string name) {
                    LoseItem();
                    packName = name;
                    currentPack = SceneManager.mainCharacter.pack.GetItemPack(name);
                    for (int i = 0; i < gridArray.Length; i++) {
                        string itemID = currentPack.GetItemIDForGrid(i);
                        IItemInfo info = Configs.itemConfig.GetItemInfo(itemID);
                        if (null == info) {
                            gridArray[i].HideItem();
                            continue;
                        } // end 
                        int count = currentPack.GetCountForGrid(i);
                        gridArray[i].SetUIItem(ResourcesTool.LoadSprite(info.spritepath), count);
                    } // end for
                } // end SwitchPack