少年修仙传客户端代码仓库
client_Hale
2019-04-19 cf4fab04c50830fb29534f0c018366708ad51c72
Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
4个文件已修改
142 ■■■■ 已修改文件
System/MainWin/HighSettingFadeInFadeOut.cs 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/MainWin/MainWinRightBottomGrid.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/MainWin/MainWinTopGrid.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/MainWin/RightBottomFadeInOut.cs 44 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/MainWin/HighSettingFadeInFadeOut.cs
@@ -17,8 +17,14 @@
        [SerializeField] Image m_ArrowOpen;
        [SerializeField] Image m_ArrowClose;
        [SerializeField] Vector2 m_GridSize;
        [SerializeField] Vector2 m_Space;
        [SerializeField] MainWinTopGrid[] m_GridGroup1;
        [SerializeField] MainWinTopGrid[] m_GridGroup2;
        [SerializeField] RectTransform m_GroupContainer1;
        [SerializeField] RectTransform m_GroupContainer2;
        State state = State.Closed;
@@ -90,7 +96,7 @@
            {
                if (!grid.alwayShow)
                {
                    grid.Switch(active, (index / 7) + 1);
                    grid.Switch(active, (index / 6) + 1);
                }
                if (grid.gameObject.activeInHierarchy)
@@ -122,7 +128,7 @@
            {
                if (!grid.alwayShow)
                {
                    grid.SwitchImmediately(active, (index / 7) + 1);
                    grid.SwitchImmediately(active, (index / 6) + 1);
                }
                if (grid.gameObject.activeInHierarchy)
@@ -203,33 +209,10 @@
        private void RefreshGridsActiveState()
        {
            foreach (var grid in m_GridGroup1)
            {
                var active = grid.IsOpen();
                if (active && !grid.gameObject.activeSelf)
                {
                    grid.gameObject.SetActive(true);
                }
                if (!active && grid.gameObject.activeSelf)
                {
                    grid.gameObject.SetActive(false);
                }
            }
            foreach (var grid in m_GridGroup2)
            {
                var active = grid.IsOpen();
                if (active && !grid.gameObject.activeSelf)
                {
                    grid.gameObject.SetActive(true);
                }
                if (!active && grid.gameObject.activeSelf)
                {
                    grid.gameObject.SetActive(false);
                }
            }
            ActiveGroup(m_GridGroup1);
            ActiveGroup(m_GridGroup2);
            LayoutGroup(m_GridGroup1, m_GroupContainer1);
            LayoutGroup(m_GridGroup2, m_GroupContainer2);
            m_Switch.gameObject.SetActive(IsShowButton());
        }
@@ -276,6 +259,56 @@
            m_ArrowClose.gameObject.SetActive(state == State.Closed);
        }
        void ActiveGroup(MainWinTopGrid[] grids)
        {
            foreach (var grid in grids)
            {
                var active = grid.IsOpen();
                if (active && !grid.gameObject.activeSelf)
                {
                    grid.gameObject.SetActive(true);
                }
                if (!active && grid.gameObject.activeSelf)
                {
                    grid.gameObject.SetActive(false);
                }
            }
        }
        void LayoutGroup(MainWinTopGrid[] grids, RectTransform container)
        {
            var index = 0;
            foreach (var grid in grids)
            {
                if (grid.gameObject.activeSelf)
                {
                    var row = index / 6;
                    var column = index % 6;
                    var x = container.rect.width * 0.5f - m_GridSize.x * (column + 0.5f) - m_Space.x * column;
                    var y = container.rect.height * 0.5f - m_GridSize.y * (row + 0.5f) - m_Space.y * row;
                    grid.rectTransform.anchoredPosition = new Vector2(x, y);
                    index++;
                }
            }
            foreach (var grid in grids)
            {
                if (grid.gameObject.activeSelf)
                {
                    grid.transform.SetAsFirstSibling();
                }
            }
        }
        [ContextMenu("Layout")]
        public void LayoutGroup()
        {
            LayoutGroup(m_GridGroup1, m_GroupContainer1);
            LayoutGroup(m_GridGroup2, m_GroupContainer2);
        }
        public enum State
        {
            Opened,
System/MainWin/MainWinRightBottomGrid.cs
@@ -12,11 +12,15 @@
    public class MainWinRightBottomGrid : MonoBehaviour
    {
        [SerializeField] int m_FunctionId;
        [SerializeField] int m_Index;
        public int index { get { return m_Index; } }
        [SerializeField] int m_FunctionId;
        [SerializeField] RectTransform m_Content;
        [SerializeField] CanvasGroup m_CanvasGroup;
        public RectTransform rectTransform { get { return this.transform as RectTransform; } }
        float targetX = 0f;
        float targetAlpha = 0f;
System/MainWin/MainWinTopGrid.cs
@@ -22,6 +22,7 @@
        [SerializeField] CanvasGroup m_CanvasGroup;
        [SerializeField] IsPlayerUIeffect m_IsPlayerUIeffect;
        public RectTransform rectTransform { get { return this.transform as RectTransform; } }
        public bool alwayShow { get { return m_AlwayShow; } }
        float targetY = 0f;
System/MainWin/RightBottomFadeInOut.cs
@@ -2,21 +2,18 @@
//    [Author]:           第二世界
//    [  Date ]:           Tuesday, April 10, 2018
//--------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Text.RegularExpressions;
using System.Text;
using Snxxz.UI;
using UnityEngine.UI;
namespace Snxxz.UI
{
    public class RightBottomFadeInOut : MonoBehaviour
    {
        [SerializeField] MainWinRightBottomGrid[] m_Grids;
        [SerializeField] List<MainWinRightBottomGrid> m_Grids;
        [SerializeField] RectTransform m_Container;
        [SerializeField] Vector2 m_GridSize;
        [SerializeField] Vector2 m_Space;
        public void Init()
        {
@@ -62,6 +59,11 @@
        private void RefreshGridsActiveState()
        {
            m_Grids.Sort((MainWinRightBottomGrid x, MainWinRightBottomGrid y) =>
            {
                return x.index.CompareTo(y.index);
            });
            foreach (var grid in m_Grids)
            {
                var active = grid.IsOpen();
@@ -76,6 +78,34 @@
                }
            }
            Layout();
        }
        [ContextMenu("Layout")]
        public void Layout()
        {
            var index = 0;
            foreach (var grid in m_Grids)
            {
                if (grid.gameObject.activeSelf)
                {
                    var row = index % 4;
                    var column = index / 4;
                    var x = m_Container.rect.width * 0.5f - m_GridSize.x * (column + 0.5f) - m_Space.x * column;
                    var y = m_Container.rect.height * 0.5f - m_GridSize.y * (row + 0.5f) - m_Space.y * row;
                    grid.rectTransform.anchoredPosition = new Vector2(x, y);
                    index++;
                }
            }
            foreach (var grid in m_Grids)
            {
                if (grid.gameObject.activeSelf)
                {
                    grid.transform.SetAsFirstSibling();
                }
            }
        }
    }