예제 #1
0
    public virtual void Reposition()
    {
        if (Application.isPlaying && !this.mInitDone && NGUITools.GetActive(base.gameObject))
        {
            this.Init();
        }
        if (this.sorted)
        {
            this.sorted = false;
            if (this.sorting == UIGrid.Sorting.None)
            {
                this.sorting = UIGrid.Sorting.Alphabetic;
            }
            NGUITools.SetDirty(this);
        }
        List <Transform> childList = this.GetChildList();

        this.ResetPosition(childList);
        if (this.keepWithinPanel)
        {
            this.ConstrainWithinPanel();
        }
        if (this.onReposition != null)
        {
            this.onReposition();
        }
    }
예제 #2
0
    public virtual void Reposition()
    {
        if (Application.isPlaying && !this.mInitDone && NGUITools.GetActive(this))
        {
            this.mReposition = true;
            return;
        }
        if (this.sorted)
        {
            this.sorted = false;
            if (this.sorting == UIGrid.Sorting.None)
            {
                this.sorting = UIGrid.Sorting.Alphabetic;
            }
            NGUITools.SetDirty(this);
        }
        if (!this.mInitDone)
        {
            this.Init();
        }
        BetterList <Transform> childList = this.GetChildList();

        if (this.sorting != UIGrid.Sorting.None)
        {
            if (this.sorting == UIGrid.Sorting.Alphabetic)
            {
                childList.Sort(new BetterList <Transform> .CompareFunc(UIGrid.SortByName));
            }
            else if (this.sorting == UIGrid.Sorting.Horizontal)
            {
                childList.Sort(new BetterList <Transform> .CompareFunc(UIGrid.SortHorizontal));
            }
            else if (this.sorting == UIGrid.Sorting.Vertical)
            {
                childList.Sort(new BetterList <Transform> .CompareFunc(UIGrid.SortVertical));
            }
            else if (this.onCustomSort != null)
            {
                childList.Sort(this.onCustomSort);
            }
            else
            {
                this.Sort(childList);
            }
        }
        this.ResetPosition(childList);
        if (this.keepWithinPanel)
        {
            this.ConstrainWithinPanel();
        }
        if (this.onReposition != null)
        {
            this.onReposition();
        }
    }
예제 #3
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();


        SerializedProperty sp = NGUIEditorTools.DrawProperty("Arrangement", serializedObject, "arrangement");

        NGUIEditorTools.DrawProperty("  Cell Width", serializedObject, "cellWidth");
        NGUIEditorTools.DrawProperty("  Cell Height", serializedObject, "cellHeight");
        NGUIEditorTools.DrawProperty("  Scroll View", serializedObject, "ScrollView");

        if (sp.intValue < 2)
        {
            bool columns = (sp.hasMultipleDifferentValues || (UIGrid.Arrangement)sp.intValue == UIGrid.Arrangement.Horizontal);

            GUILayout.BeginHorizontal();
            {
                sp = NGUIEditorTools.DrawProperty(columns ? "  Column Limit" : "  Row Limit", serializedObject, "maxPerLine");
                if (sp.intValue < 0)
                {
                    sp.intValue = 0;
                }
                if (sp.intValue == 0)
                {
                    GUILayout.Label("Unlimited");
                }
            }
            GUILayout.EndHorizontal();

            UIGrid.Sorting sort = (UIGrid.Sorting)NGUIEditorTools.DrawProperty("Sorting", serializedObject, "sorting").intValue;

            if (sp.intValue != 0 && (sort == UIGrid.Sorting.Horizontal || sort == UIGrid.Sorting.Vertical))
            {
                EditorGUILayout.HelpBox("Horizontal and Vertical sortinig only works if the number of rows/columns remains at 0.", MessageType.Warning);
            }
        }

        NGUIEditorTools.DrawProperty("Pivot", serializedObject, "pivot");
        NGUIEditorTools.DrawProperty("Smooth Tween", serializedObject, "animateSmoothly");
        NGUIEditorTools.DrawProperty("Hide Inactive", serializedObject, "hideInactive");
        NGUIEditorTools.DrawProperty("Constrain to Panel", serializedObject, "keepWithinPanel");
        NGUIEditorTools.DrawProperty("Auto Look Center", serializedObject, "AutoLookCenter");

        NGUIEditorTools.DrawProperty("Item prefab path", serializedObject, "PrefabPath");

        serializedObject.ApplyModifiedProperties();
    }
예제 #4
0
 public override void Unity_Deserialize(int depth)
 {
     this.arrangement     = (UIGrid.Arrangement)SerializedStateReader.Instance.ReadInt32();
     this.sorting         = (UIGrid.Sorting)SerializedStateReader.Instance.ReadInt32();
     this.pivot           = (UIWidget.Pivot)SerializedStateReader.Instance.ReadInt32();
     this.maxPerLine      = SerializedStateReader.Instance.ReadInt32();
     this.cellWidth       = SerializedStateReader.Instance.ReadSingle();
     this.cellHeight      = SerializedStateReader.Instance.ReadSingle();
     this.animateSmoothly = SerializedStateReader.Instance.ReadBoolean();
     SerializedStateReader.Instance.Align();
     this.hideInactive = SerializedStateReader.Instance.ReadBoolean();
     SerializedStateReader.Instance.Align();
     this.keepWithinPanel = SerializedStateReader.Instance.ReadBoolean();
     SerializedStateReader.Instance.Align();
     this.sorted = SerializedStateReader.Instance.ReadBoolean();
     SerializedStateReader.Instance.Align();
 }
예제 #5
0
    static int set_sorting(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UIGrid         obj  = (UIGrid)o;
            UIGrid.Sorting arg0 = (UIGrid.Sorting)ToLua.CheckObject(L, 2, typeof(UIGrid.Sorting));
            obj.sorting = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index sorting on a nil value" : e.Message));
        }
    }
예제 #6
0
    static int get_sorting(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UIGrid         obj = (UIGrid)o;
            UIGrid.Sorting ret = obj.sorting;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index sorting on a nil value" : e.Message));
        }
    }
예제 #7
0
    private static int set_sorting(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            UIGrid         uIGrid  = (UIGrid)obj;
            UIGrid.Sorting sorting = (UIGrid.Sorting)((int)ToLua.CheckObject(L, 2, typeof(UIGrid.Sorting)));
            uIGrid.sorting = sorting;
            result         = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index sorting on a nil value");
        }
        return(result);
    }
예제 #8
0
    private static int get_sorting(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            UIGrid         uIGrid  = (UIGrid)obj;
            UIGrid.Sorting sorting = uIGrid.sorting;
            ToLua.Push(L, sorting);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index sorting on a nil value");
        }
        return(result);
    }
예제 #9
0
    public unsafe override void Unity_NamedDeserialize(int depth)
    {
        ISerializedNamedStateReader arg_1A_0 = SerializedNamedStateReader.Instance;

        byte[] var_0_cp_0 = $FieldNamesStorage.$RuntimeNames;
        int    var_0_cp_1 = 0;

        this.arrangement     = (UIGrid.Arrangement)arg_1A_0.ReadInt32(&var_0_cp_0[var_0_cp_1] + 928);
        this.sorting         = (UIGrid.Sorting)SerializedNamedStateReader.Instance.ReadInt32(&var_0_cp_0[var_0_cp_1] + 940);
        this.pivot           = (UIWidget.Pivot)SerializedNamedStateReader.Instance.ReadInt32(&var_0_cp_0[var_0_cp_1] + 697);
        this.maxPerLine      = SerializedNamedStateReader.Instance.ReadInt32(&var_0_cp_0[var_0_cp_1] + 948);
        this.cellWidth       = SerializedNamedStateReader.Instance.ReadSingle(&var_0_cp_0[var_0_cp_1] + 959);
        this.cellHeight      = SerializedNamedStateReader.Instance.ReadSingle(&var_0_cp_0[var_0_cp_1] + 969);
        this.animateSmoothly = SerializedNamedStateReader.Instance.ReadBoolean(&var_0_cp_0[var_0_cp_1] + 980);
        SerializedNamedStateReader.Instance.Align();
        this.hideInactive = SerializedNamedStateReader.Instance.ReadBoolean(&var_0_cp_0[var_0_cp_1] + 996);
        SerializedNamedStateReader.Instance.Align();
        this.keepWithinPanel = SerializedNamedStateReader.Instance.ReadBoolean(&var_0_cp_0[var_0_cp_1] + 1009);
        SerializedNamedStateReader.Instance.Align();
        this.sorted = SerializedNamedStateReader.Instance.ReadBoolean(&var_0_cp_0[var_0_cp_1] + 1025);
        SerializedNamedStateReader.Instance.Align();
    }
예제 #10
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        SerializedProperty sp = NGUIEditorTools.DrawProperty("Arrangement", serializedObject, "arrangement");

        //    public float R = 100f;//半径
        //public float angle = 90f;//间隔角度
        //public float startAngle = 0;//起始角度
        NGUIEditorTools.DrawProperty("  R", serializedObject, "R");
        NGUIEditorTools.DrawProperty("  angle", serializedObject, "angle");
        NGUIEditorTools.DrawProperty("  startAngle", serializedObject, "startAngle");

        if (sp.intValue < 2)
        {
            //bool columns = (sp.hasMultipleDifferentValues || (UIGrid.Arrangement)sp.intValue == UIGrid.Arrangement.Horizontal);

            //GUILayout.BeginHorizontal();
            //{
            //    sp = NGUIEditorTools.DrawProperty(columns ? "  Column Limit" : "  Row Limit", serializedObject, "maxPerLine");
            //    if (sp.intValue < 0) sp.intValue = 0;
            //    if (sp.intValue == 0) GUILayout.Label("Unlimited");
            //}
            //GUILayout.EndHorizontal();

            UIGrid.Sorting sort = (UIGrid.Sorting)NGUIEditorTools.DrawProperty("Sorting", serializedObject, "sorting").intValue;

            if (sp.intValue != 0 && (sort == UIGrid.Sorting.Horizontal || sort == UIGrid.Sorting.Vertical))
            {
                EditorGUILayout.HelpBox("Horizontal and Vertical sortinig only works if the number of rows/columns remains at 0.", MessageType.Warning);
            }
        }

        NGUIEditorTools.DrawProperty("Pivot", serializedObject, "pivot");
        NGUIEditorTools.DrawProperty("Smooth Tween", serializedObject, "animateSmoothly");
        NGUIEditorTools.DrawProperty("Hide Inactive", serializedObject, "hideInactive");
        NGUIEditorTools.DrawProperty("Constrain to Panel", serializedObject, "keepWithinPanel");
        serializedObject.ApplyModifiedProperties();
    }
예제 #11
0
 public virtual void Reposition()
 {
     if (Application.isPlaying && !this.mInitDone && NGUITools.GetActive(base.gameObject))
     {
         this.Init();
     }
     if (this.sorted)
     {
         this.sorted = false;
         if (this.sorting == UIGrid.Sorting.None)
         {
             this.sorting = UIGrid.Sorting.Alphabetic;
         }
         NGUITools.SetDirty(this);
     }
     List<Transform> childList = this.GetChildList();
     this.ResetPosition(childList);
     if (this.keepWithinPanel)
     {
         this.ConstrainWithinPanel();
     }
     if (this.onReposition != null)
     {
         this.onReposition();
     }
 }