Example #1
0
                } // end OnClickInfoBtn

                public void DoBeforeEntering() {
                    gameObject = ObjectTool.InstantiateGo("InfoPanelUI", ResourcesTool.LoadPrefabUI(id), 
                        SceneManager.mainCanvas.rectTransform);
                    rectTransform = gameObject.GetComponent<RectTransform>();
                    rectTransform.sizeDelta = SceneManager.mainCanvas.sizeDelta;
                    selected = "";
                    infoText = rectTransform.Find("InfoText").GetComponent<Text>();
                    infoText.fontSize = 10;
                    display = rectTransform.Find("DisplayRaw").gameObject.AddComponent<UIDisplayRaw>();
                    display.SetDisplayGo(new DisplayRole(GameManager.playerInfo.roletype, SceneManager.mainCharacter.pack.GetWearInfo()));
                    cellDict = new Dictionary<string, UICell>();
                    for (int i = 0; i < ConstConfig.EquipTypeList.Length; i++) {
                        string type = ConstConfig.EquipTypeList[i];
                        cellDict[type] = rectTransform.Find("Cells/Cell_" + i).gameObject.AddComponent<UICell>();
                        cellDict[type].AddAction(delegate () { OnSelectedCell(type); });
                    } // end for
                    selector = rectTransform.Find("Selector").gameObject;
                    selector.SetActive(false);
                    infoPanel = rectTransform.Find("InfoPanel").gameObject;
                    cellText = infoPanel.transform.Find("InfoText").GetComponent<Text>();
                    cellText.fontSize = 10;
                    infoPanel.SetActive(false);
                    rectTransform.Find("TakeOffBtn").gameObject.AddComponent<UIButtonNormal>().AddListener(OnClickTakeOffBtn);
                    rectTransform.Find("CloseBtn").gameObject.AddComponent<UIButtonNormal>().AddListener(delegate () { OnClickCloseBtn(); },  "ui_close");
                    UpdateShowInfo();
                } // end DoBeforeEntering
Example #2
0
                } // end UICreateRolePanel

                private void OnSwitchRole(string roleType)
                {
                    if (this.roleType == roleType)
                    {
                        return;
                    }
                    // end if
                    this.roleType = roleType;
                    display.SetDisplayGo(new DisplayRole(roleType));
                } // end OnSwitchRole
                }         // end InitialSwitchRole

                private void OnSwitchRole(int index)
                {
                    if (!ChechExitID(index))
                    {
                        createIndex = index;
                        SceneManager.uiPanelFMS.PerformTransition(new UICreateRolePanel());
                        return;
                    } // end if
                    if (selectedindex == index)
                    {
                        return;
                    }
                    // end if
                    roleindex       = index;
                    selectedindex   = index;
                    t_roleName.text = roleDict[index][0];
                    Dictionary <string, string> wearDict;

                    SqliteManager.GetWearInfoWithID(GameManager.playerInfo.username, roleindex, out wearDict);
                    display.SetDisplayGo(new DisplayRole(roleDict[index][1], wearDict));
                } // end OnSwitchRole