Ejemplo n.º 1
0
        /// <summary>
        /// 设置人物属性修改功能
        /// </summary>
        private void BasicPropertiesUI()
        {
            DateFile instance = DateFile.instance;

            if (instance == null || instance.mianActorId == 0)
            {
                GUILayout.Box("未载入存档", boxStyle, GUILayout.Width(mWindowWidth));
                return;
            }
            GUILayout.Label("<color=#87CEEB>修改人物:</color>", labelStyle, GUILayout.Width(mWindowWidth));
            // 选择属性修改的主体
            var basePropertyChooseTmp = GUILayout.SelectionGrid(basePropertyChoose, new string[]
            {
                "<color=#FFA500>太吾本人</color>",
                "<color=#FFA500>最近打开过人物菜单的人物</color>",
                "<color=#FFA500>自定义人物</color>"
            }, 3, buttonStyle, GUILayout.Width(mWindowWidth));

            if (basePropertyChoose != basePropertyChooseTmp)
            {
                ActorPropertyHelper.Instance.SetAllFieldsNeedToUpdate();
                if (basePropertyChooseTmp == 2)
                {
                    displayedActorId = actorId.ToString();
                }
            }
            basePropertyChoose = basePropertyChooseTmp;
            GUILayout.Label("<color=#87CEEB>修改完成后数值不发生变化是游戏界面没有刷新的原因,并不是修改不成功。" +
                            "属性资质修改需重新进入人物菜单才会刷新结果而资源和威望修改需发生对应变化的行为后才会更新。" +
                            "所有资质属性均为基础值,不含特性、装备、早熟晚熟以及年龄加成</color>", labelStyle, GUILayout.Width(mWindowWidth));
            // 显示待修改人物的ID
            DisplayId(instance);
            // 显示待修改人物的姓名
            GUILayout.Box($"<color=#FFA500>{instance.GetActorName(actorId)}</color>", nameFieldStyle, GUILayout.Width(mWindowWidth));
            var fontStyle = labelStyle.fontStyle;

            labelStyle.fontStyle = FontStyle.Bold;
            GUILayout.Label("<color=#F28234>点击按钮修改对应类型属性</color>", labelStyle, GUILayout.Width(mWindowWidth));
            labelStyle.fontStyle = fontStyle;
            scrollPosition[1]    = GUILayout.BeginScrollView(scrollPosition[1], GUILayout.MinWidth(mWindowWidth));
            ModData(instance);
            GUILayout.EndScrollView();

            /*if (Event.current.type == EventType.Repaint)
             * {
             *  var tmpRect = GUILayoutUtility.GetLastRect();
             *  Main.logger.Log($"tmprect2: {tmpRect.x} {tmpRect.y} {tmpRect.height} {tmpRect.width}");
             * }*/
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 设置人物属性修改功能
        /// </summary>
        private void BasicPropertiesUI()
        {
            DateFile instance = DateFile.instance;

            if (instance == null || instance.mianActorId == 0)
            {
                GUILayout.Box("未载入存档", boxStyle);
                return;
            }
            GUILayout.Label("<color=#87CEEB>修改人物:</color>", labelStyle);
            // 选择属性修改的主体
            var basePropertyChooseTmp = GUILayout.SelectionGrid(basePropertyChoose, new string[]
            {
                "<color=#FFA500>太吾本人</color>",
                "<color=#FFA500>最近打开过人物菜单的人物</color>",
                "<color=#FFA500>自定义人物</color>"
            }, 3, buttonStyle);

            if (basePropertyChoose != basePropertyChooseTmp)
            {
                helper.ResetAllFields();
                if (basePropertyChooseTmp == 2)
                {
                    displayedActorId = actorId.ToString();
                }
            }
            basePropertyChoose = basePropertyChooseTmp;
            GUILayout.Label("<color=#87CEEB>修改完成后数值不发生变化是游戏界面没有刷新的原因,并不是修改不成功。" +
                            "属性资质修改需重新进入人物菜单才会刷新结果而资源和威望修改需发生对应变化的行为后才会更新。" +
                            "所有资质属性均为基础值,不含特性、装备、早熟晚熟以及年龄加成</color>", labelStyle);
            // 显示待修改人物的ID
            DisplayId();
            // 显示待修改人物的姓名
            GUILayout.Box($"<color=#FFA500>{instance.GetActorName(actorId)}</color>", nameFieldStyle);
            labelStyle.fontStyle = FontStyle.Bold;
            GUILayout.Label("<color=#F28234>点击按钮修改对应类型属性</color>", labelStyle);
            labelStyle.fontStyle = FontStyle.Normal;
            ModData(instance);
        }
Ejemplo n.º 3
0
        void InitUI()
        {
            // 主Canvs 开关
            #region MainCanvas
            mainCanvas = UICreator.CreateCanvas(name: "IllustratedHandbookCanvas");
#if UNITY_EDITOR
            mainCanvas.GetComponent <Canvas>().renderMode  = RenderMode.ScreenSpaceCamera;
            mainCanvas.GetComponent <Canvas>().worldCamera = GameObject.Find("Main Camera").GetComponent <Camera>();
#else
            mainCanvas.GetComponent <Canvas>().renderMode = RenderMode.ScreenSpaceOverlay;
#endif
            mainCanvas.GetComponent <Canvas>().sortingLayerName = "GUI";
            mainCanvas.GetComponent <Canvas>().sortingOrder     = 998; // ShowTips 的 sortingorder 为1000
            DontDestroyOnLoad(mainCanvas);
            mainPanel        = UICreator.CreatePanel(mainCanvas.gameObject, "MainPanel");
            mainPanel.sprite = Resources.Load("Graphics/BaseUI/GUI_Window_Big_Black_NoColor", typeof(Sprite)) as Sprite;
            mainPanel.color  = new Color32(100, 100, 100, 255);
            SetAnchor(mainPanel.gameObject, v3(1), v2(0.5f), v2(0.5f), Vector2.zero, Vector2.zero).sizeDelta = v2(700, 600);
            #endregion

            // 主面板
            #region MainPanel
            handbookPanel = UICreator.CreatePanel(mainPanel.gameObject, "IllustratedHandbookPanel");
            SetAnchor(handbookPanel.gameObject, v3(1), v2(0), v2(1), v2(10), v2(-10, -25));

            titlePanel = UICreator.CreatePanel(handbookPanel.gameObject, "TitlePanel");
            SetAnchor(titlePanel.gameObject, v3(1), v2(0.5f, 1), v2(0.5f, 1), v2(0), v2(0)).sizeDelta = v2(680, 50);
            titlePanel.rectTransform.anchoredPosition3D = v3(0, -25, 0);

            titlePanel.gameObject.AddComponent(typeof(EventTrigger));
            titlePanelOndrag = titlePanel.GetComponent <EventTrigger>();
            EventTrigger.Entry eventEntry = new EventTrigger.Entry();
            eventEntry.eventID = EventTriggerType.Drag;
            eventEntry.callback.AddListener((data) =>
            {
                OnDragDelegate((PointerEventData)data);
            });
            titlePanelOndrag.triggers.Add(eventEntry);


            titleText = CreateText("TitleText", titlePanel.gameObject, "<b>图鉴/添加物品 1.0.2</b>", Color.white, 27, v2(0.5f, 1), v2(0.5f, 1), v2(680, 30), v2(0, -25));
            #endregion


            // 加载中面板
            #region LoadingPanel
            loadingPanel = UICreator.CreatePanel(handbookPanel.gameObject, "LoadingPanel");
            SetAnchor(loadingPanel.gameObject, v3(1), v2(0), v2(1), v2(0), v2(0, -50));

            // 加载中文字区域
            loadingTextPanel        = UICreator.CreatePanel(loadingPanel.gameObject, "LoadingTextPanel");
            loadingTextPanel.sprite = Resources.Load("Graphics/BaseUI/GUI_BarBack", typeof(Sprite)) as Sprite;
            loadingTextPanel.color  = new Color32(255, 255, 255, 44);
            SetAnchor(loadingTextPanel.gameObject, v3(1), v2(0), v2(1), v2(20, 130), v2(-20, 0));

            tipText = CreateText("TipText", loadingTextPanel.gameObject,
                                 "游戏未开始 尚未加载数据\n\n请先开始游戏~\n\n\n" +
                                 "<size=16><color=white><b>Tips:</b>\n Ctrl + F11开关窗口\n<b>拖动标题</b>可以移动窗口哦\n" +
                                 "获取书籍会随机残页、无法查看促织\n" +
                                 "获取物品后需重新打开背包才看的到\n推荐配合《功法书籍显示》MOD使用\n<color=red>NEW</color> 在人物菜单切换到同道可以将物品直接添加到同道背包(不会影响亲密)\n" +
                                 "<b>工具无错</b> 请<b>自觉</b>平衡游戏体验</color></size>",
                                 new Color32(0, 255, 213, 255), 28, v2(0.5f), v2(0.5f), v2(600, 400), v2(0)
                                 );

            aboutText = CreateText("AboutText", loadingPanel.gameObject, "By: yyuueexxiinngg", Color.white, 14, v2(0), v2(0), v2(160, 30), v2(128.8f, 13.9f));
            aboutText.GetComponent <Text>().alignment = TextAnchor.UpperLeft;

            NGAButton = CreateButton("NGAButton", loadingPanel.gameObject, "点此打开本MOD NGA发布地址", Color.white, "Graphics/BaseUI/GUI_Base", Color.black, v2(0.5f, 0), v2(0.5f, 0), v2(500, 31), v2(0, 100));
            NGAButton.GetComponent <Button>().onClick.AddListener(() =>
            {
                Application.OpenURL("https://nga.178.com/read.php?tid=15239374");
            });

            GithubButton = CreateButton("GithubBotton", loadingPanel.gameObject, "点此打开MOD开源项目Github地址", Color.white, "Graphics/BaseUI/GUI_Base", Color.black, v2(0.5f, 0), v2(0.5f, 0), v2(500, 31), v2(0, 55));
            GithubButton.GetComponent <Button>().onClick.AddListener(() =>
            {
                Application.OpenURL("https://github.com/yyuueexxiinngg/Taiwu_mods");
            });
            #endregion

            // 过滤面板
            #region FilterPanel
            filterPanel = UICreator.CreatePanel(handbookPanel.gameObject, "FilterPanel");
            SetAnchor(filterPanel.gameObject, v3(1), v2(0), v2(1), v2(50, 50), v2(-50, -50));

            itemTypePanel = UICreator.CreatePanel(filterPanel.gameObject, "ItemTypeGrid");
            SetAnchor(itemTypePanel.gameObject, v3(1), v2(0), v2(1), v2(0, 100), v2(0, -50));

            itemTypePanel.gameObject.AddComponent <GridLayoutGroup>();
            itemTypePanel.GetComponent <GridLayoutGroup>().cellSize = v2(110, 30);
            itemTypePanel.GetComponent <GridLayoutGroup>().spacing  = v2(6, 3);

            CreateText("FilterTypeLabel", filterPanel.gameObject, "当前选择种类:", Color.white, 14, v2(0, 1), v2(0, 1), v2(160, 30), v3(50, -30, 0));
            filterTypeCurrent = CreateText("FilterTypeCurrent", filterPanel.gameObject, "未初始化", Color.white, 20, v2(0, 1), v2(0, 1), v2(160, 30), v3(120, -30, 0));


            itemLevelPanel = UICreator.CreatePanel(filterPanel.gameObject, "ItemLevelGrid");
            SetAnchor(itemLevelPanel.gameObject, v3(1), v2(0), v2(1), v2(0), v2(0, -370));

            itemLevelPanel.gameObject.AddComponent <GridLayoutGroup>();
            itemLevelPanel.GetComponent <GridLayoutGroup>().cellSize = v2(140, 30);
            itemLevelPanel.GetComponent <GridLayoutGroup>().spacing  = v2(6, 3);

            CreateText("FilterLevelLabel", filterPanel.gameObject, "当前选择品级:", Color.white, 14, v2(0, 1), v2(0, 1), v2(160, 30), v3(300, -30, 0));
            filterLevelCurrent = CreateText("FilterLevelCurrent", filterPanel.gameObject, itemLevel[selectedLevel].Split('|')[0], Color.white, 20, v2(0, 1), v2(0, 1), v2(160, 30), v3(380, -30, 0));

            var filterCancelBtn  = CreateButton("FilterCancelBtn", filterPanel.gameObject, "取消", Color.white, "Graphics/BaseUI/GUI_ValuBack", Color.white, v2(0), v2(0), v2(200, 30), v2(160, -25));
            var filterRefreshBtn = CreateButton("FilterRefreshBtn", filterPanel.gameObject, "刷新物品列表", Color.white, "Graphics/BaseUI/GUI_ValuBack", Color.white, v2(1, 0), v2(1, 0), v2(200, 30), v2(-160, -25));

            filterCancelBtn.GetComponent <Button>().onClick.AddListener(() =>
            {
                filterPanel.gameObject.SetActive(false);
                loadedPanel.gameObject.SetActive(true);
            });

            filterRefreshBtn.GetComponent <Button>().onClick.AddListener(() =>
            {
                selectedType  = selectedTypeUnsaved;
                selectedLevel = selectedLevelUnsaved;
                // 清空物品列表
                itemList = new Dictionary <int, Dictionary <int, string> >();

                if (selectedType != 0) // 如果选择不是全部
                {
                    foreach (var item in dataInstance.presetitemDate)
                    {
                        // item.Value[5]即为物品种类 item.Value[8]即为物品品级
                        if (int.Parse(item.Value[5]) == selectedType && (selectedLevel == 0 || int.Parse(item.Value[8]) == selectedLevel))
                        {
                            itemList[item.Key] = item.Value;
                        }
                    }
                }
                else // 如果是全部
                {
                    if (selectedLevel == 0) // 如果品级是全部
                    {
                        itemList = dataInstance.presetitemDate;
                    }
                    else
                    {
                        foreach (var item in dataInstance.presetitemDate)
                        {
                            if (int.Parse(item.Value[8]) == selectedLevel)
                            {
                                itemList[item.Key] = item.Value;
                            }
                        }
                    }
                }
                DrawItems();
                filterPanel.gameObject.SetActive(false);
                loadedPanel.gameObject.SetActive(true);
            });


            #endregion


            // 加载完成后面板
            #region LoadedPanel
            loadedPanel = UICreator.CreatePanel(handbookPanel.gameObject, "LoadedPanel");
            SetAnchor(loadedPanel.gameObject, v3(1), v2(0), v2(1), v2(0, 50), v2(0, -50));


            itemPanel        = UICreator.CreatePanel(loadedPanel.gameObject, "ItemPanel");
            itemPanel.sprite = Resources.Load("Graphics/BaseUI/GUI_BarBack", typeof(Sprite)) as Sprite;
            itemPanel.color  = new Color32(255, 255, 255, 44);
            SetAnchor(itemPanel.gameObject, v3(1), v2(0), v2(1), v2(20, 0), v2(-20, 0));

            var selectionPanel = UICreator.CreatePanel(itemPanel.gameObject, "SelectionPanel");
            SetAnchor(selectionPanel.gameObject, v3(1), v2(0), v2(1), v2(30, 415), v2(-30, -15));

            var itemFilterButton = CreateButton("ItemFilterButton", selectionPanel.gameObject, "过滤", Color.white, "Graphics/BaseUI/GUI_ValuBack", Color.white, v2(0.5f), v2(0.5f), v2(160, 30), v3(0));
            itemFilterButton.GetComponent <Button>().onClick.AddListener(() =>
            {
                string[] itemTypes = itemType.Split('|');
                filterTypeCurrent.GetComponent <Text>().text  = itemTypes[selectedType];
                filterLevelCurrent.GetComponent <Text>().text = itemLevel[selectedLevel].Split('|')[0];
                loadedPanel.gameObject.SetActive(false);
                filterPanel.gameObject.SetActive(true);
            });

            // 物品栏
            itemGrid = new GameObject("ItemGrid", typeof(GridLayoutGroup));
            itemGrid.transform.SetParent(itemPanel.transform);
            var itemGridComponent = itemGrid.GetComponent <GridLayoutGroup>();
            itemGridComponent.cellSize    = v2(65, 65);
            itemGridComponent.startCorner = GridLayoutGroup.Corner.UpperLeft;
            itemGridComponent.startAxis   = GridLayoutGroup.Axis.Horizontal;

            SetAnchor(itemGrid.gameObject, v3(1), v2(0), v2(1), v2(30, 0), v2(0, -50));

            itemBack = Resources.LoadAll <Sprite>("Graphics/ItemIcon/ItemIconBack");
            itemIcon = Resources.LoadAll <Sprite>("Graphics/ItemIcon/ItemIcon");


            EventTrigger.Entry itemSlotOnMouseEnterEntry = new EventTrigger.Entry();
            itemSlotOnMouseEnterEntry.eventID = EventTriggerType.PointerEnter;
            itemSlotOnMouseEnterEntry.callback.AddListener((data) =>
            {
                OnMouseEnterDelegate((PointerEventData)data);
            });

            EventTrigger.Entry itemSlotOnMouseExitEntry = new EventTrigger.Entry();
            itemSlotOnMouseExitEntry.eventID = EventTriggerType.PointerExit;
            itemSlotOnMouseExitEntry.callback.AddListener((data) =>
            {
                OnMouseExitDelegate((PointerEventData)data);
            });

            // 物品槽
            for (int i = 0; i < 54; i++)
            {
                var itemSlot = new GameObject("ItemSlot|" + i, typeof(RectTransform));
                itemSlot.transform.SetParent(itemGrid.transform);
                itemSlot.transform.localScale = v3(1);

                itemSlot.AddComponent(typeof(Button));
                itemSlot.GetComponent <Button>().onClick.AddListener(
                    () =>
                {
                    if (itemSlot.name.Split('|')[1] != "10000")
                    {
                        if (DateFile.instance.GetItem(ActorMenu.instance.actorMenu.activeInHierarchy ? ActorMenu.instance.acotrId : DateFile.instance.MianActorID(), int.Parse(itemSlot.name.Split('|')[1]), 1, true) > 0)
                        {
                            TipsWindow.instance.SetTips(5007, new string[] { dataInstance.GetActorName(ActorMenu.instance.actorMenu.activeInHierarchy ? ActorMenu.instance.acotrId : DateFile.instance.MianActorID()), itemList[int.Parse(itemSlot.name.Split('|')[1])][0], "" }, 100);
                        }
                        else
                        {
                            TipsWindow.instance.SetTips(0, new string[] { "无法添加此物品~" }, 100);
                        }
                    }
                    else
                    {
                        TipsWindow.instance.SetTips(0, new string[] { "无法添加促织~" }, 100);
                    }
                }
                    );

                itemSlot.AddComponent(typeof(EventTrigger));
                var itemSlotOnHover = itemSlot.GetComponent <EventTrigger>();
                itemSlotOnHover.triggers.Add(itemSlotOnMouseEnterEntry);
                itemSlotOnHover.triggers.Add(itemSlotOnMouseExitEntry);

                var itemBackObj = new GameObject("ItemBack", typeof(Image));
                itemBackObj.transform.SetParent(itemSlot.transform);
                itemBackObj.GetComponent <Image>().sprite            = itemBack[4];
                itemBackObj.GetComponent <Image>().color             = new Color32(254, 47, 17, 255);
                itemBackObj.transform.localScale                     = v3(1);
                itemBackObj.GetComponent <RectTransform>().sizeDelta = v2(60, 60);
                itemBackObj.GetComponent <Image>().preserveAspect    = true;

                var itemIconObj = new GameObject("ItemIcon", typeof(Image));
                itemIconObj.transform.SetParent(itemBackObj.transform);
                itemIconObj.GetComponent <Image>().sprite            = itemIcon[i];
                itemIconObj.transform.localScale                     = v3(1);
                itemIconObj.GetComponent <RectTransform>().sizeDelta = v2(40, 40);

                // 物品下标文字 i.e. 0/0 本MOD未使用到所以没有赋值
                CreateText("ItemText", itemBackObj, "", Color.white, 14, v2(0), v2(1, 0.3f), v2(1), v3(0));
                itemIconObj.GetComponent <Image>().preserveAspect = true;

                // itemSlot.SetActive(false);
                Vector3 position = itemSlot.transform.localPosition;
                position.z = 0;
                itemSlot.transform.localPosition = position;

                itemSlots.Add(itemSlot);
            }

            prePageButton  = CreateButton("PrePageBotton", loadedPanel.gameObject, "上一页", Color.white, "Graphics/BaseUI/GUI_ValuBack", Color.white, v2(0), v2(0), v2(200, 30), v2(160, -25));
            nextPageButton = CreateButton("PrePageBotton", loadedPanel.gameObject, "下一页", Color.white, "Graphics/BaseUI/GUI_ValuBack", Color.white, v2(1, 0), v2(1, 0), v2(200, 30), v2(-160, -25));

            var itemPageTextObj = CreateText("ItemPageText", loadedPanel.gameObject, "0/0", Color.white, 20, v2(0.5f, 0), v2(0.5f, 0), v2(80, 30), v3(0, -25, 0));
            itemPageText = itemPageTextObj.GetComponent <Text>();

            // 初始化页标
            itemPageText.text = "1/1";

            prePageButton.GetComponent <Button>().onClick.AddListener(
                () =>
            {
                if (itemSlotPage > 0)
                {
                    // 如果到达过最后一页 遍历一遍itemSlots全部激活
                    if (finalPageReached)
                    {
                        foreach (var itemSlot in itemSlots)
                        {
                            itemSlot.SetActive(true);
                        }
                    }

                    --itemSlotPage;

                    // 用以获取当前循环对应的itemSlot
                    int index = 0;

                    foreach (var item in itemList.Skip(itemSlotPage * 54).Take(54))
                    {
                        itemSlots[index].name = "ItemSlot|" + item.Key;
                        itemSlots[index].transform.GetChild(0).GetChild(0).GetComponent <Image>().sprite = itemIcon[int.Parse(item.Value[98])];
                        itemSlots[index].transform.GetChild(0).GetComponent <Image>().sprite             = itemBack[int.Parse(item.Value[4])];
                        itemSlots[index].transform.GetChild(0).GetChild(1).GetComponent <Text>().text    = item.Value[0];
                        Color backgroundColor = Color.white;
                        ColorUtility.TryParseHtmlString(itemLevel[int.Parse(item.Value[8])].Split('|')[1], out backgroundColor);
                        itemSlots[index].transform.GetChild(0).GetComponent <Image>().color = backgroundColor;
                        index++;
                    }

                    itemPageText.text = string.Format("{0}/{1}", itemSlotPage + 1, itemList.Count % 54 == 0 ? itemList.Count / 54 : (itemList.Count / 54) + 1);
                }
            }
                );

            nextPageButton.GetComponent <Button>().onClick.AddListener(
                () =>
            {
                if (itemSlotPage < itemList.Count / 54)
                {
                    ++itemSlotPage;

                    int index = 0;

                    foreach (var item in itemList.Skip(itemSlotPage * 54).Take(54))
                    {
                        if (itemSlotPage * 54 <= itemList.Count - 54)
                        {
                            finalPageReached = false;
                        }
                        else
                        {
                            finalPageReached = true;
                        }
                        itemSlots[index].name = "ItemSlot|" + item.Key;
                        itemSlots[index].transform.GetChild(0).GetChild(0).GetComponent <Image>().sprite = itemIcon[int.Parse(item.Value[98])];
                        itemSlots[index].transform.GetChild(0).GetComponent <Image>().sprite             = itemBack[int.Parse(item.Value[4])];
                        itemSlots[index].transform.GetChild(0).GetChild(1).GetComponent <Text>().text    = item.Value[0];
                        Color backgroundColor = Color.white;
                        ColorUtility.TryParseHtmlString(itemLevel[int.Parse(item.Value[8])].Split('|')[1], out backgroundColor);
                        itemSlots[index].transform.GetChild(0).GetComponent <Image>().color = backgroundColor;
                        index++;
                    }

                    itemPageText.text = string.Format("{0}/{1}", itemSlotPage + 1, itemList.Count % 54 == 0 ? itemList.Count / 54 : (itemList.Count / 54) + 1);

                    if (finalPageReached)
                    {
                        for (int i = 53; i >= index; i--)
                        {
                            itemSlots[i].SetActive(false);
                        }
                    }
                }
            }
                );
            #endregion

            loadedPanel.gameObject.SetActive(false);
            loadingPanel.gameObject.SetActive(true);
            filterPanel.gameObject.SetActive(false);
        }
Ejemplo n.º 4
0
        private void WindowFunction(int windowId)
        {
            if (Input.GetKey(KeyCode.LeftControl))
            {
                GUI.DragWindow(mWindowRect);
            }

            GUILayout.BeginVertical("box");
            GUILayout.BeginHorizontal("box");
            GUILayout.Label("NPC查找器");
            if (GUILayout.Button("关闭", GUILayout.Width(150)))
            {
                ToggleWindow();
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal("box");
            GUILayout.Label("年龄:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(minage.ToString(), 3, GUILayout.Width(30)), out minage);
            GUILayout.Label("--", GUILayout.Width(10));
            int.TryParse(GUILayout.TextField(maxage.ToString(), 3, GUILayout.Width(30)), out maxage);
            GUILayout.Space(10);
            GUILayout.Label("性别:", GUILayout.Width(30));
            GUILayout.Space(5);
            isall = GUILayout.Toggle(isall, "全部", GUILayout.Width(45));
            if (isall)
            {
                iswoman     = false;
                isman       = false;
                genderValue = 0;
            }

            isman = GUILayout.Toggle(isman, "男", GUILayout.Width(30));
            if (isman)
            {
                isall       = false;
                iswoman     = false;
                genderValue = 1;
            }
            iswoman = GUILayout.Toggle(iswoman, "女", GUILayout.Width(30));
            if (iswoman)
            {
                isall       = false;
                isman       = false;
                genderValue = 2;
            }
            GUILayout.Space(10);
            GUILayout.Label("膂力:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(strValue.ToString(), 10, GUILayout.Width(30)), out strValue);
            GUILayout.Space(5);
            GUILayout.Label("体质:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(conValue.ToString(), 10, GUILayout.Width(30)), out conValue);
            GUILayout.Space(5);
            GUILayout.Label("灵敏:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(agiValue.ToString(), 10, GUILayout.Width(30)), out agiValue);
            GUILayout.Space(5);
            GUILayout.Label("根骨:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(bonValue.ToString(), 10, GUILayout.Width(30)), out bonValue);
            GUILayout.Space(5);
            GUILayout.Label("悟性:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(intValue.ToString(), 10, GUILayout.Width(30)), out intValue);
            GUILayout.Space(5);
            GUILayout.Label("定力:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(patValue.ToString(), 10, GUILayout.Width(30)), out patValue);
            GUILayout.Space(5);
            GUILayout.Label("魅力:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(charmValue.ToString(), 10, GUILayout.Width(30)), out charmValue);
            GUILayout.Space(5);
            GUILayout.Label("健康:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(healthValue.ToString(), 10, GUILayout.Width(30)), out healthValue);
            GUILayout.Space(5);
            GUILayout.Label("轮回次数:", GUILayout.Width(60));
            int.TryParse(GUILayout.TextField(samsaraCount.ToString(), 10, GUILayout.Width(30)), out samsaraCount);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal("box");
            GUILayout.Label("内功:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(gongfa[0].ToString(), 10, GUILayout.Width(30)), out gongfa[0]);
            GUILayout.Space(5);
            GUILayout.Label("身法:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(gongfa[1].ToString(), 10, GUILayout.Width(30)), out gongfa[1]);
            GUILayout.Space(5);
            GUILayout.Label("绝技:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(gongfa[2].ToString(), 10, GUILayout.Width(30)), out gongfa[2]);
            GUILayout.Space(5);
            GUILayout.Label("拳掌:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(gongfa[3].ToString(), 10, GUILayout.Width(30)), out gongfa[3]);
            GUILayout.Space(5);
            GUILayout.Label("指法:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(gongfa[4].ToString(), 10, GUILayout.Width(30)), out gongfa[4]);
            GUILayout.Space(5);
            GUILayout.Label("腿法:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(gongfa[5].ToString(), 10, GUILayout.Width(30)), out gongfa[5]);
            GUILayout.Space(5);
            GUILayout.Label("暗器:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(gongfa[6].ToString(), 10, GUILayout.Width(30)), out gongfa[6]);
            GUILayout.Space(5);
            GUILayout.Label("剑法:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(gongfa[7].ToString(), 10, GUILayout.Width(30)), out gongfa[7]);
            GUILayout.Space(5);
            GUILayout.Label("刀法:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(gongfa[8].ToString(), 10, GUILayout.Width(30)), out gongfa[8]);
            GUILayout.Space(5);
            GUILayout.Label("长兵:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(gongfa[9].ToString(), 10, GUILayout.Width(30)), out gongfa[9]);
            GUILayout.Space(5);
            GUILayout.Label("奇门:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(gongfa[10].ToString(), 10, GUILayout.Width(30)), out gongfa[10]);
            GUILayout.Space(5);
            GUILayout.Label("软兵:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(gongfa[11].ToString(), 10, GUILayout.Width(30)), out gongfa[11]);
            GUILayout.Space(5);
            GUILayout.Label("御射:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(gongfa[12].ToString(), 10, GUILayout.Width(30)), out gongfa[12]);
            GUILayout.Space(5);
            GUILayout.Label("乐器:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(gongfa[13].ToString(), 10, GUILayout.Width(30)), out gongfa[13]);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal("box");
            GUILayout.Label("音律:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(life[0].ToString(), 10, GUILayout.Width(30)), out life[0]);
            GUILayout.Space(5);
            GUILayout.Label("弈棋:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(life[1].ToString(), 10, GUILayout.Width(30)), out life[1]);
            GUILayout.Space(5);
            GUILayout.Label("诗书:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(life[2].ToString(), 10, GUILayout.Width(30)), out life[2]);
            GUILayout.Space(5);
            GUILayout.Label("绘画:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(life[3].ToString(), 10, GUILayout.Width(30)), out life[3]);
            GUILayout.Space(5);
            GUILayout.Label("术数:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(life[4].ToString(), 10, GUILayout.Width(30)), out life[4]);
            GUILayout.Space(5);
            GUILayout.Label("品鉴:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(life[5].ToString(), 10, GUILayout.Width(30)), out life[5]);
            GUILayout.Space(5);
            GUILayout.Label("锻造:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(life[6].ToString(), 10, GUILayout.Width(30)), out life[6]);
            GUILayout.Space(5);
            GUILayout.Label("制木:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(life[7].ToString(), 10, GUILayout.Width(30)), out life[7]);
            GUILayout.Space(5);
            GUILayout.Label("医术:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(life[8].ToString(), 10, GUILayout.Width(30)), out life[8]);
            GUILayout.Space(5);
            GUILayout.Label("毒术:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(life[9].ToString(), 10, GUILayout.Width(30)), out life[9]);
            GUILayout.Space(5);
            GUILayout.Label("织锦:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(life[10].ToString(), 10, GUILayout.Width(30)), out life[10]);
            GUILayout.Space(5);
            GUILayout.Label("巧匠:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(life[11].ToString(), 10, GUILayout.Width(30)), out life[11]);
            GUILayout.Space(5);
            GUILayout.Label("道法:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(life[12].ToString(), 10, GUILayout.Width(30)), out life[12]);
            GUILayout.Space(5);
            GUILayout.Label("佛学:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(life[13].ToString(), 10, GUILayout.Width(30)), out life[13]);
            GUILayout.Space(5);
            GUILayout.Label("厨艺:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(life[14].ToString(), 10, GUILayout.Width(30)), out life[14]);
            GUILayout.Space(5);
            GUILayout.Label("杂学:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(life[15].ToString(), 10, GUILayout.Width(30)), out life[15]);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal("box");
            GUILayout.Label("姓名(包括前世):", GUILayout.Width(120));
            name = GUILayout.TextField(name, 10, GUILayout.Width(80));
            //从属gangText
            GUILayout.Label("从属:", GUILayout.Width(50));
            gangValue = GUILayout.TextField(gangValue, 10, GUILayout.Width(60));
            //身份gangLevelText
            //GUILayout.Label("从属:", GUILayout.Width(50));
            //gangValue = GUILayout.TextField(gangValue, 10, GUILayout.Width(60));
            //立场goodnessText
            string goodnessText = "";

            GUILayout.Label("立场:", GUILayout.Width(30));
            for (int i = 0; i < goodness.Length; i++)
            {
                goodness[i] = GUILayout.Toggle(goodness[i], goodnessValue[i].ToString(), GUILayout.Width(45));
                if (goodness[i])
                {
                    for (int j = 0; j < goodness.Length; j++)
                    {
                        if (i != j)
                        {
                            goodness[j]  = false;
                            goodnessText = goodnessValue[i].ToString();
                        }
                    }
                }
            }

            GUILayout.Space(30);
            if (GUILayout.Button("查找", GUILayout.Width(150)))
            {
                actorList.Clear();
                DateFile dateFile = DateFile.instance;
                Dictionary <int, Dictionary <int, string> > actors = dateFile.actorsDate;
                foreach (int index in actors.Keys)
                {
                    Dictionary <int, string> actor = actors[index];
                    int str     = dateFile.BaseAttr(index, 0, 0);
                    int con     = dateFile.BaseAttr(index, 1, 0);
                    int agi     = dateFile.BaseAttr(index, 2, 0);
                    int bon     = dateFile.BaseAttr(index, 3, 0);
                    int inv     = dateFile.BaseAttr(index, 4, 0);
                    int pat     = dateFile.BaseAttr(index, 5, 0);
                    int age     = int.Parse(dateFile.GetActorDate(index, 11, false));
                    int gender  = int.Parse(dateFile.GetActorDate(index, 14, false));
                    int charm   = int.Parse(DateFile.instance.GetActorDate(index, 15, true));
                    int samsara = dateFile.GetLifeDateList(index, 801, false).Count;
                    int health  = ActorMenu.instance.Health(index);

                    if (inv >= intValue &&
                        str >= strValue &&
                        con >= conValue &&
                        agi >= agiValue &&
                        bon >= bonValue &&
                        pat >= patValue &&
                        charm >= charmValue &&
                        age >= minage &&
                        health >= healthValue &&
                        samsara >= samsaraCount &&
                        (maxage == 0 || age <= maxage) &&
                        (genderValue == 0 || gender == genderValue)
                        )
                    {
                        string genderText;
                        if (gender == 1)
                        {
                            genderText = "男";
                        }
                        else
                        {
                            genderText = "女";
                        }
                        string place;
                        if (int.Parse(dateFile.GetActorDate(index, 8, false)) != 1)
                        {
                            place = dateFile.massageDate[8010][3].Split(new char[] { '|' })[1];
                        }
                        else
                        {
                            List <int> list = new List <int>(dateFile.GetActorAtPlace(index));
                            place = string.Format("{0}{1}", new object[]
                            {
                                dateFile.GetNewMapDate(list[0], list[1], 98),
                                dateFile.GetNewMapDate(list[0], list[1], 0)
                            });
                        }

                        string actorName = dateFile.GetActorName(index);

                        string charmText = ((int.Parse(DateFile.instance.GetActorDate(index, 11, false)) > 14) ? ((int.Parse(DateFile.instance.GetActorDate(index, 8, false)) != 1 || int.Parse(DateFile.instance.GetActorDate(index, 305, false)) != 0) ? DateFile.instance.massageDate[25][int.Parse(DateFile.instance.GetActorDate(index, 14, false)) - 1].Split(new char[]
                        {
                            '|'
                        })[Mathf.Clamp(int.Parse(DateFile.instance.GetActorDate(index, 15, true)) / 100, 0, 9)] : DateFile.instance.massageDate[25][5].Split(new char[]
                        {
                            '|'
                        })[1]) : DateFile.instance.massageDate[25][5].Split(new char[]
                        {
                            '|'
                        })[0]);

                        List <int> samsaraList  = dateFile.GetLifeDateList(index, 801, false);
                        string     samsaraNames = "";
                        foreach (int samsaraId in samsaraList)
                        {
                            samsaraNames = samsaraNames + " " + dateFile.GetActorName(samsaraId);
                        }
                        if (GetLevelValue(index, 0, 1) >= gongfa[0] &&
                            GetLevelValue(index, 1, 1) >= gongfa[1] &&
                            GetLevelValue(index, 1, 1) >= gongfa[1] &&
                            GetLevelValue(index, 2, 1) >= gongfa[2] &&
                            GetLevelValue(index, 3, 1) >= gongfa[3] &&
                            GetLevelValue(index, 4, 1) >= gongfa[4] &&
                            GetLevelValue(index, 5, 1) >= gongfa[5] &&
                            GetLevelValue(index, 6, 1) >= gongfa[6] &&
                            GetLevelValue(index, 7, 1) >= gongfa[7] &&
                            GetLevelValue(index, 8, 1) >= gongfa[8] &&
                            GetLevelValue(index, 9, 1) >= gongfa[9] &&
                            GetLevelValue(index, 10, 1) >= gongfa[10] &&
                            GetLevelValue(index, 11, 1) >= gongfa[11] &&
                            GetLevelValue(index, 12, 1) >= gongfa[12] &&
                            GetLevelValue(index, 13, 1) >= gongfa[13] &&
                            GetLevelValue(index, 0, 0) >= life[0] &&
                            GetLevelValue(index, 1, 0) >= life[1] &&
                            GetLevelValue(index, 2, 0) >= life[2] &&
                            GetLevelValue(index, 3, 0) >= life[3] &&
                            GetLevelValue(index, 4, 0) >= life[4] &&
                            GetLevelValue(index, 5, 0) >= life[5] &&
                            GetLevelValue(index, 6, 0) >= life[6] &&
                            GetLevelValue(index, 7, 0) >= life[7] &&
                            GetLevelValue(index, 8, 0) >= life[8] &&
                            GetLevelValue(index, 9, 0) >= life[9] &&
                            GetLevelValue(index, 10, 0) >= life[10] &&
                            GetLevelValue(index, 11, 0) >= life[11] &&
                            GetLevelValue(index, 12, 0) >= life[12] &&
                            GetLevelValue(index, 13, 0) >= life[13] &&
                            GetLevelValue(index, 14, 0) >= life[14] &&
                            GetLevelValue(index, 15, 0) >= life[15]
                            )
                        {
                            string gn      = dateFile.massageDate[9][0].Split(new char[] { '|' })[DateFile.instance.GetActorGoodness(index)];
                            int    groupid = int.Parse(DateFile.instance.GetActorDate(index, 19, false));//身份组ID
                            if (goodnessText.Equals("全部") || gn.Contains(goodnessText))
                            {
                                if ((actorName.Contains(name) || samsaraNames.Contains(name)) && (dateFile.GetGangDate(groupid, 0).Contains(gangValue)))
                                {
                                    int gangLevel   = int.Parse(DateFile.instance.GetActorDate(index, 20, false));                                    //身份等级
                                    int gangValueId = DateFile.instance.GetGangValueId(groupid, gangLevel);
                                    int key2        = (gangLevel >= 0) ? 1001 : (1001 + int.Parse(DateFile.instance.GetActorDate(index, 14, false))); //性别标识

                                    actorList.Add(new string[] { actorName, age.ToString(), genderText, place,
                                                                 charm + "(" + charmText + ")",                                                                                                                         //魅力
                                                                 dateFile.GetGangDate(groupid, 0),                                                                                                                      //从属gangText
                                                                 dateFile.SetColoer((gangValueId != 0) ? (20011 - Mathf.Abs(gangLevel)) : 20002, DateFile.instance.presetGangGroupDateValue[gangValueId][key2], false), //身份gangLevelText
                                                                 gn,                                                                                                                                                    //立场goodnessText
                                                                 GetHealth(index),                                                                                                                                      //健康
                                                                 str.ToString(), con.ToString(), agi.ToString(), bon.ToString(), inv.ToString(), pat.ToString(),
                                                                 GetLevel(index, 0, 1),
                                                                 GetLevel(index, 1, 1),
                                                                 GetLevel(index, 2, 1),
                                                                 GetLevel(index, 3, 1),
                                                                 GetLevel(index, 4, 1),
                                                                 GetLevel(index, 5, 1),
                                                                 GetLevel(index, 6, 1),
                                                                 GetLevel(index, 7, 1),
                                                                 GetLevel(index, 8, 1),
                                                                 GetLevel(index, 9, 1),
                                                                 GetLevel(index, 10, 1),
                                                                 GetLevel(index, 11, 1),
                                                                 GetLevel(index, 12, 1),
                                                                 GetLevel(index, 13, 1),
                                                                 GetLevel(index, 0, 0),
                                                                 GetLevel(index, 1, 0),
                                                                 GetLevel(index, 2, 0),
                                                                 GetLevel(index, 3, 0),
                                                                 GetLevel(index, 4, 0),
                                                                 GetLevel(index, 5, 0),
                                                                 GetLevel(index, 6, 0),
                                                                 GetLevel(index, 7, 0),
                                                                 GetLevel(index, 8, 0),
                                                                 GetLevel(index, 9, 0),
                                                                 GetLevel(index, 10, 0),
                                                                 GetLevel(index, 11, 0),
                                                                 GetLevel(index, 12, 0),
                                                                 GetLevel(index, 13, 0),
                                                                 GetLevel(index, 14, 0),
                                                                 GetLevel(index, 15, 0),
                                                                 samsaraNames });
                                }
                            }
                        }
                    }
                }
            }
            GUILayout.EndHorizontal();

            if (actorList.Count > 0)
            {
                scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, false, new GUIStyle(), new GUIStyle(), GUILayout.Height(80), GUILayout.Width(Screen.width * 0.8f - 40f));
                GUILayout.BeginVertical("Box");
                GUILayout.BeginHorizontal("box");
                var amountWidth = mColumns.Where(x => !x.skip).Sum(x => x.width);
                var expandWidth = mColumns.Where(x => x.expand && !x.skip).Sum(x => x.width);
                var mods        = actorList;
                var colWidth    = mColumns.Select(x =>
                                                  x.expand
                        ? GUILayout.Width(x.width / expandWidth * (960f - 60 + expandWidth - amountWidth))
                        : GUILayout.Width(x.width)).ToArray();
                for (int i = 0; i < mColumns.Count; i++)
                {
                    if (mColumns[i].skip)
                    {
                        continue;
                    }
                    GUILayout.Label(mColumns[i].name, colWidth[i]);
                }
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal("box");
                for (int i = 0; i < mColumns.Count; i++)
                {
                    if (mColumns[i].skip)
                    {
                        continue;
                    }
                    if (GUILayout.Button("O", colWidth[i]))
                    {
                        Debug.Log("Clicked the " + mColumns[i].name);
                        sortIndex = i;
                        actorList.Sort(SortList);
                        desc = !desc;
                    }
                }
                GUILayout.EndHorizontal();
                GUILayout.EndVertical();
                GUILayout.EndScrollView();
                scrollPosition2 = GUILayout.BeginScrollView(scrollPosition2, GUILayout.ExpandHeight(false));
                scrollPosition  = new Vector2(scrollPosition2.x, 0);
                GUILayout.BeginVertical("box");
                int c = mods.Count;
                c = c > 50 ? 50 : c;
                for (int i = 0; i < c; i++)
                {
                    GUILayout.BeginVertical("box");
                    GUILayout.BeginHorizontal();
                    for (int j = 0; j < mods[i].Count(); j++)
                    {
                        GUILayout.BeginHorizontal(colWidth[j]);
                        GUILayout.Label(mods[i][j].ToString());
                        GUILayout.EndHorizontal();
                    }
                    GUILayout.EndHorizontal();
                    GUILayout.EndVertical();
                }

                GUILayout.EndVertical();
                GUILayout.EndScrollView();
            }
            GUILayout.EndVertical();
            GUILayout.Space(3);
        }
Ejemplo n.º 5
0
        void ScanNpc()
        {
            actorList.Clear();
            DateFile dateFile = DateFile.instance;
            Dictionary <int, Dictionary <int, string> > actors = dateFile.actorsDate;

            foreach (int index in actors.Keys)
            {
                Dictionary <int, string> actor = actors[index];
                int str     = dateFile.BaseAttr(index, 0, 0);
                int con     = dateFile.BaseAttr(index, 1, 0);
                int agi     = dateFile.BaseAttr(index, 2, 0);
                int bon     = dateFile.BaseAttr(index, 3, 0);
                int inv     = dateFile.BaseAttr(index, 4, 0);
                int pat     = dateFile.BaseAttr(index, 5, 0);
                int age     = int.Parse(dateFile.GetActorDate(index, 11, false));
                int gender  = int.Parse(dateFile.GetActorDate(index, 14, false));
                int charm   = int.Parse(DateFile.instance.GetActorDate(index, 15, true));
                int samsara = dateFile.GetLifeDateList(index, 801, false).Count;
                int health  = ActorMenu.instance.Health(index);
                int cv      = charmValue;
                if (charmValue == 0)
                {
                    cv = -999;
                }

                if (inv >= intValue &&
                    str >= strValue &&
                    con >= conValue &&
                    agi >= agiValue &&
                    bon >= bonValue &&
                    pat >= patValue &&
                    charm >= cv &&
                    age >= minage &&
                    health >= healthValue &&
                    samsara >= samsaraCount &&
                    (maxage == 0 || age <= maxage) &&
                    (genderValue == 0 || gender == genderValue)
                    )
                {
                    string genderText;
                    if (gender == 1)
                    {
                        genderText = "男";
                    }
                    else
                    {
                        genderText = "女";
                    }
                    string place;
                    if (int.Parse(dateFile.GetActorDate(index, 8, false)) != 1)
                    {
                        place = dateFile.massageDate[8010][3].Split(new char[] { '|' })[1];
                    }
                    else
                    {
                        List <int> list = new List <int>(dateFile.GetActorAtPlace(index));
                        place = string.Format("{0}{1}", new object[]
                        {
                            dateFile.GetNewMapDate(list[0], list[1], 98),
                            dateFile.GetNewMapDate(list[0], list[1], 0)
                        });
                    }

                    string actorName = dateFile.GetActorName(index);

                    string charmText = ((int.Parse(DateFile.instance.GetActorDate(index, 11, false)) > 14) ? ((int.Parse(DateFile.instance.GetActorDate(index, 8, false)) != 1 || int.Parse(DateFile.instance.GetActorDate(index, 305, false)) != 0) ? DateFile.instance.massageDate[25][int.Parse(DateFile.instance.GetActorDate(index, 14, false)) - 1].Split(new char[]
                    {
                        '|'
                    })[Mathf.Clamp(int.Parse(DateFile.instance.GetActorDate(index, 15, true)) / 100, 0, 9)] : DateFile.instance.massageDate[25][5].Split(new char[]
                    {
                        '|'
                    })[1]) : DateFile.instance.massageDate[25][5].Split(new char[]
                    {
                        '|'
                    })[0]);

                    List <int> samsaraList  = dateFile.GetLifeDateList(index, 801, false);
                    string     samsaraNames = "";
                    foreach (int samsaraId in samsaraList)
                    {
                        samsaraNames = samsaraNames + " " + dateFile.GetActorName(samsaraId);
                    }

                    int[] actorResources = ActorMenu.instance.GetActorResources(index);

                    if (GetLevelValue(index, 0, 1) >= gongfa[0] &&
                        GetLevelValue(index, 1, 1) >= gongfa[1] &&
                        GetLevelValue(index, 1, 1) >= gongfa[1] &&
                        GetLevelValue(index, 2, 1) >= gongfa[2] &&
                        GetLevelValue(index, 3, 1) >= gongfa[3] &&
                        GetLevelValue(index, 4, 1) >= gongfa[4] &&
                        GetLevelValue(index, 5, 1) >= gongfa[5] &&
                        GetLevelValue(index, 6, 1) >= gongfa[6] &&
                        GetLevelValue(index, 7, 1) >= gongfa[7] &&
                        GetLevelValue(index, 8, 1) >= gongfa[8] &&
                        GetLevelValue(index, 9, 1) >= gongfa[9] &&
                        GetLevelValue(index, 10, 1) >= gongfa[10] &&
                        GetLevelValue(index, 11, 1) >= gongfa[11] &&
                        GetLevelValue(index, 12, 1) >= gongfa[12] &&
                        GetLevelValue(index, 13, 1) >= gongfa[13] &&
                        GetLevelValue(index, 0, 0) >= life[0] &&
                        GetLevelValue(index, 1, 0) >= life[1] &&
                        GetLevelValue(index, 2, 0) >= life[2] &&
                        GetLevelValue(index, 3, 0) >= life[3] &&
                        GetLevelValue(index, 4, 0) >= life[4] &&
                        GetLevelValue(index, 5, 0) >= life[5] &&
                        GetLevelValue(index, 6, 0) >= life[6] &&
                        GetLevelValue(index, 7, 0) >= life[7] &&
                        GetLevelValue(index, 8, 0) >= life[8] &&
                        GetLevelValue(index, 9, 0) >= life[9] &&
                        GetLevelValue(index, 10, 0) >= life[10] &&
                        GetLevelValue(index, 11, 0) >= life[11] &&
                        GetLevelValue(index, 12, 0) >= life[12] &&
                        GetLevelValue(index, 13, 0) >= life[13] &&
                        GetLevelValue(index, 14, 0) >= life[14] &&
                        GetLevelValue(index, 15, 0) >= life[15]
                        )
                    {
                        string gn            = dateFile.massageDate[9][0].Split(new char[] { '|' })[DateFile.instance.GetActorGoodness(index)];
                        int    groupid       = int.Parse(DateFile.instance.GetActorDate(index, 19, false));                                                                                           //身份组ID
                        int    gangLevel     = int.Parse(DateFile.instance.GetActorDate(index, 20, false));                                                                                           //身份等级
                        int    gangValueId   = DateFile.instance.GetGangValueId(groupid, gangLevel);
                        int    key2          = (gangLevel >= 0) ? 1001 : (1001 + int.Parse(DateFile.instance.GetActorDate(index, 14, false)));                                                        //性别标识
                        string gangLevelText = dateFile.SetColoer((gangValueId != 0) ? (20011 - Mathf.Abs(gangLevel)) : 20002, DateFile.instance.presetGangGroupDateValue[gangValueId][key2], false); //身份gangLevelText

                        if (ScanFeature(index, GetFeatureKey(actorFeatureText)) || actorFeatureText == "")
                        {
                            if (goodnessText.Equals("全部") || gn.Contains(goodnessText))
                            {
                                if ((actorName.Contains(name) || samsaraNames.Contains(name)) && (dateFile.GetGangDate(groupid, 0).Contains(gangValue)) && (gangLevelText.Contains(gangLevelValue)))
                                {
                                    actorList.Add(new string[] { actorName, age.ToString(), genderText, place,
                                                                 charm + "(" + charmText + ")",    //魅力
                                                                 dateFile.GetGangDate(groupid, 0), //从属gangText
                                                                 gangLevelText,                    //身份gangLevelText
                                                                 gn,                               //立场goodnessText
                                                                 GetSpouse(index),                 //
                                                                 GetSkillDevelopText(index),
                                                                 GetGongFaDevelopText(index),
                                                                 GetHealth(index),//健康
                                                                 str.ToString(), con.ToString(), agi.ToString(), bon.ToString(), inv.ToString(), pat.ToString(),
                                                                 GetLevel(index, 0, 1),
                                                                 GetLevel(index, 1, 1),
                                                                 GetLevel(index, 2, 1),
                                                                 GetLevel(index, 3, 1),
                                                                 GetLevel(index, 4, 1),
                                                                 GetLevel(index, 5, 1),
                                                                 GetLevel(index, 6, 1),
                                                                 GetLevel(index, 7, 1),
                                                                 GetLevel(index, 8, 1),
                                                                 GetLevel(index, 9, 1),
                                                                 GetLevel(index, 10, 1),
                                                                 GetLevel(index, 11, 1),
                                                                 GetLevel(index, 12, 1),
                                                                 GetLevel(index, 13, 1),
                                                                 GetLevel(index, 0, 0),
                                                                 GetLevel(index, 1, 0),
                                                                 GetLevel(index, 2, 0),
                                                                 GetLevel(index, 3, 0),
                                                                 GetLevel(index, 4, 0),
                                                                 GetLevel(index, 5, 0),
                                                                 GetLevel(index, 6, 0),
                                                                 GetLevel(index, 7, 0),
                                                                 GetLevel(index, 8, 0),
                                                                 GetLevel(index, 9, 0),
                                                                 GetLevel(index, 10, 0),
                                                                 GetLevel(index, 11, 0),
                                                                 GetLevel(index, 12, 0),
                                                                 GetLevel(index, 13, 0),
                                                                 GetLevel(index, 14, 0),
                                                                 GetLevel(index, 15, 0),
                                                                 actorResources[0].ToString(),
                                                                 actorResources[1].ToString(),
                                                                 actorResources[2].ToString(),
                                                                 actorResources[3].ToString(),
                                                                 actorResources[4].ToString(),
                                                                 actorResources[5].ToString(),
                                                                 actorResources[6].ToString(),
                                                                 samsaraNames,
                                                                 GetActorFeatureNameText(index) });
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 6
0
        private void WindowFunction(int windowId)
        {
            if (Input.GetKey(KeyCode.LeftControl))
            {
                GUI.DragWindow(mWindowRect);
            }

            GUILayout.BeginVertical("box");
            GUILayout.BeginHorizontal("box");
            GUILayout.Label("NPC查找器");
            if (GUILayout.Button("关闭", GUILayout.Width(150)))
            {
                ToggleWindow();
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal("box");
            GUILayout.Label("年龄:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(minage.ToString(), 3, GUILayout.Width(30)), out minage);
            GUILayout.Label("--", GUILayout.Width(10));
            int.TryParse(GUILayout.TextField(maxage.ToString(), 3, GUILayout.Width(30)), out maxage);
            GUILayout.Space(5);
            GUILayout.Label("性别:", GUILayout.Width(30));
            GUILayout.Space(5);
            isall = GUILayout.Toggle(isall, "全部", GUILayout.Width(45));
            if (isall)
            {
                iswoman     = false;
                isman       = false;
                genderValue = 0;
            }

            isman = GUILayout.Toggle(isman, "男", GUILayout.Width(30));
            if (isman)
            {
                isall       = false;
                iswoman     = false;
                genderValue = 1;
            }
            iswoman = GUILayout.Toggle(iswoman, "女", GUILayout.Width(30));
            if (iswoman)
            {
                isall       = false;
                isman       = false;
                genderValue = 2;
            }
            GUILayout.Space(10);
            GUILayout.Label("膂力:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(strValue.ToString(), 10, GUILayout.Width(30)), out strValue);
            GUILayout.Space(5);
            GUILayout.Label("体质:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(conValue.ToString(), 10, GUILayout.Width(30)), out conValue);
            GUILayout.Space(5);
            GUILayout.Label("灵敏:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(agiValue.ToString(), 10, GUILayout.Width(30)), out agiValue);
            GUILayout.Space(5);
            GUILayout.Label("根骨:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(bonValue.ToString(), 10, GUILayout.Width(30)), out bonValue);
            GUILayout.Space(5);
            GUILayout.Label("悟性:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(intValue.ToString(), 10, GUILayout.Width(30)), out intValue);
            GUILayout.Space(5);
            GUILayout.Label("定力:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(patValue.ToString(), 10, GUILayout.Width(30)), out patValue);
            GUILayout.Space(5);
            GUILayout.Label("魅力:", GUILayout.Width(30));
            int.TryParse(GUILayout.TextField(charmValue.ToString(), 10, GUILayout.Width(30)), out charmValue);
            GUILayout.Space(50);
            if (GUILayout.Button("查找", GUILayout.Width(150)))
            {
                actorList.Clear();
                DateFile dateFile = DateFile.instance;
                Dictionary <int, Dictionary <int, string> > actors = dateFile.actorsDate;
                foreach (int index in actors.Keys)
                {
                    Dictionary <int, string> actor = actors[index];
                    int str    = dateFile.BaseAttr(index, 0, 0);
                    int con    = dateFile.BaseAttr(index, 1, 0);
                    int agi    = dateFile.BaseAttr(index, 2, 0);
                    int bon    = dateFile.BaseAttr(index, 3, 0);
                    int inv    = dateFile.BaseAttr(index, 4, 0);
                    int pat    = dateFile.BaseAttr(index, 5, 0);
                    int age    = int.Parse(dateFile.GetActorDate(index, 11, false));
                    int gender = int.Parse(dateFile.GetActorDate(index, 14, false));
                    int charm  = int.Parse(DateFile.instance.GetActorDate(index, 15, true));
                    if (inv >= intValue &&
                        str > strValue &&
                        con > conValue &&
                        agi > agiValue &&
                        bon > bonValue &&
                        pat > patValue &&
                        charm > charmValue &&
                        age > minage &&
                        (maxage == 0 || age < maxage) &&
                        (genderValue == 0 || gender == genderValue)
                        )
                    {
                        string genderText;
                        if (gender == 1)
                        {
                            genderText = "男";
                        }
                        else
                        {
                            genderText = "女";
                        }
                        string place;
                        if (int.Parse(dateFile.GetActorDate(index, 8, false)) != 1)
                        {
                            place = dateFile.massageDate[8010][3].Split(new char[] { '|' })[1];
                        }
                        else
                        {
                            List <int> list = new List <int>(dateFile.GetActorAtPlace(index));
                            place = string.Format("{0}{1}", new object[]
                            {
                                dateFile.GetNewMapDate(list[0], list[1], 98),
                                dateFile.GetNewMapDate(list[0], list[1], 0)
                            });
                        }

                        string charmText = ((int.Parse(DateFile.instance.GetActorDate(index, 11, false)) > 14) ? ((int.Parse(DateFile.instance.GetActorDate(index, 8, false)) != 1 || int.Parse(DateFile.instance.GetActorDate(index, 305, false)) != 0) ? DateFile.instance.massageDate[25][int.Parse(DateFile.instance.GetActorDate(index, 14, false)) - 1].Split(new char[]
                        {
                            '|'
                        })[Mathf.Clamp(int.Parse(DateFile.instance.GetActorDate(index, 15, true)) / 100, 0, 9)] : DateFile.instance.massageDate[25][5].Split(new char[]
                        {
                            '|'
                        })[1]) : DateFile.instance.massageDate[25][5].Split(new char[]
                        {
                            '|'
                        })[0]);

                        actorList.Add(string.Format("\n姓名:{1}  年龄:{8}  性别:{9}  位置:{10}  魅力:{11}  膂力:{2}  体质:{3}  灵敏:{4}  根骨:{5}  悟性:{6}  定力:{7} ", index, dateFile.GetActorName(index), str, con, agi, bon, inv, pat, age, genderText, place, charm + "(" + charmText + ")"));
                    }
                }
            }
            GUILayout.EndHorizontal();
            if (actorList.Count > 0)
            {
                scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.ExpandHeight(false));
                foreach (string actor in actorList)
                {
                    GUILayout.Label(actor);
                }
                GUILayout.EndScrollView();
            }
            GUILayout.EndVertical();
            GUILayout.Space(3);
        }