/// <summary>
        /// 关闭按钮
        /// </summary>
        /// <param name="position"></param>
        public static void CloseButton(Rect position)
        {
            GUILayout.BeginArea(position);
            {
                Texture2D normal = new Texture2D(1, 1, TextureFormat.RGBA32, false);
                normal.SetPixel(0, 0, new Color32(255, 107, 129, 255));    // rgb(255, 107, 129)
                normal.Apply();
                Texture2D active = new Texture2D(1, 1, TextureFormat.RGBA32, false);
                active.SetPixel(0, 0, new Color32(112, 161, 255, 255));  // rgba(112, 161, 255,1.0)
                active.Apply();

                if (XmGUI.Button("关闭", normal, active))
                {
                    ScriptTrainer.DisplayingWindow = false;
                }
            }
            GUILayout.EndArea();
        }
 /// <summary>
 /// 显示右侧TAB按钮组
 /// </summary>
 /// <param name="position"></param>
 public static void RightWindow(Rect position)
 {
     if (TabButtonStaty.GetWindowStat <windowsStat>())
     {
         GUILayout.BeginArea(position);
         {
             foreach (var item in TabButtonStaty)
             {
                 if (XmGUI.Button(item.Text, item.Value))
                 {
                     TabButtonStaty.ChangeWindowStat <windowsStat>(item.Key, true);
                     Debug.addLog("切换窗口为:" + item.Text);
                 }
             }
         }
         GUILayout.EndArea();
     }
 }
Ejemplo n.º 3
0
        // 解锁科技
        void AddlocktechTable(Rect AddlocktechRect)
        {
            if (GameMain.mainPlayer == null)
            {
                GUILayout.Label("请先进入游戏", new GUIStyle
                {
                    fontSize    = 26,
                    fixedWidth  = 700,
                    fixedHeight = 300,
                    alignment   = TextAnchor.MiddleCenter
                });
                return;
            }

            // 科技列表
            TechProto[] dataArray = LDB.techs.dataArray;

            GUILayout.BeginArea(AddlocktechRect);
            {
                scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, false, GUILayout.Width(700), GUILayout.Height(300));
                {
                    GUILayout.BeginHorizontal(new GUIStyle {
                        alignment = TextAnchor.UpperLeft
                    });
                    {
                        if (XmGUI.Button("解锁全部"))
                        {
                            for (int i = 0; i < dataArray.Length; i++)
                            {
                                var item = dataArray[i];
                                GameMain.history.UnlockTech(item.ID);
                            }
                        }
                    }
                    XmGUI.hr(); // 换行
                    for (int i = 0; i < dataArray.Length; i++)
                    {
                        var item = dataArray[i];

                        if (searchItem == "")
                        {
                            // 普通模式
                            if (XmGUI.Button(item.name, item.iconSprite.texture))
                            {
                                //int num = AddItemNum;
                                //int res = GameMain.mainPlayer.package.AddItemStacked(item.ID, num);
                                //UIItemup.Up(item.ID, num);
                                // 解锁科技
                                GameMain.history.UnlockTech(item.ID);
                            }
                        }
                        else
                        {
                            // 如果用户输入搜索
                            if (item.name.Contains(searchItem))
                            {
                                if (XmGUI.Button(item.name, item.iconSprite.texture))
                                {
                                    //int num = AddItemNum;
                                    //int res = GameMain.mainPlayer.package.AddItemStacked(item.ID, num);
                                    //UIItemup.Up(item.ID, num);

                                    // 解锁科技
                                    GameMain.history.UnlockTech(item.ID);
                                }
                            }
                        }

                        int listNum = 5;
                        if ((i + 1) % listNum == 0)
                        {
                            XmGUI.hr();
                        }
                    }
                    GUILayout.EndHorizontal();
                }
                GUILayout.EndScrollView();
            }
            GUILayout.EndArea();
        }
Ejemplo n.º 4
0
        // 添加物品
        void AddItemTable(Rect AddItemTableRect)
        {
            if (GameMain.mainPlayer == null)
            {
                GUILayout.Label("请先进入游戏", new GUIStyle
                {
                    fontSize    = 26,
                    fixedWidth  = 700,
                    fixedHeight = 300,
                    alignment   = TextAnchor.MiddleCenter
                });
                return;
            }
            Rect HeaderTableRect = new Rect(0, 40, 700, 40);

            AddItemHeader(HeaderTableRect);

            // 物品列表
            ItemProto[] dataArray = LDB.items.dataArray;

            AddItemTableRect.y += 30;

            GUILayout.BeginArea(AddItemTableRect);
            {
                scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, false, GUILayout.Width(700), GUILayout.Height(300));
                {
                    GUILayout.BeginHorizontal(new GUIStyle {
                        alignment = TextAnchor.UpperLeft
                    });
                    for (int i = 0; i < dataArray.Length; i++)
                    {
                        var item = dataArray[i];



                        if (searchItem == "")
                        {
                            // 普通模式
                            //if (XmGUI.Button(item.name))
                            if (XmGUI.Button(item.name, item.iconSprite.texture))
                            {
                                int num = AddItemNum;
                                int res = GameMain.mainPlayer.package.AddItemStacked(item.ID, num);
                                UIItemup.Up(item.ID, num);

                                //// 添加物品代码
                                //int ID = 6001;
                                //int num = 1000;
                                //int res = GameMain.mainPlayer.package.AddItemStacked(ID, num);
                                //UIItemup.Up(ID, num);
                            }
                        }
                        else
                        {
                            // 如果用户输入搜索
                            if (item.name.Contains(searchItem))
                            {
                                if (XmGUI.Button(item.name, item.iconSprite.texture))
                                {
                                    int num = AddItemNum;
                                    int res = GameMain.mainPlayer.package.AddItemStacked(item.ID, num);
                                    UIItemup.Up(item.ID, num);
                                }
                            }
                        }

                        int listNum = 5;    // 每行个数
                        if ((i + 1) % listNum == 0)
                        {
                            XmGUI.hr();
                        }
                    }
                    if (searchItem == "" || "沙土".Contains(searchItem))
                    {
                        if (XmGUI.Button("沙土"))
                        {
                            GameMain.mainPlayer.SetSandCount(GameMain.mainPlayer.sandCount + AddItemNum);
                        }
                    }

                    GUILayout.EndHorizontal();
                }
                GUILayout.EndScrollView();
            }
            GUILayout.EndArea();
        }