예제 #1
0
 public CornerPacket(CornerDesign design, int slotindex, int socketaxi_index, bool invx, bool invy)
 {
     this.design          = design;
     this.socketaxi_index = socketaxi_index;
     this.slotindex       = slotindex;
     this.invx            = invx;
     this.invy            = invy;
 }
예제 #2
0
    private void AddSelected()
    {
        if (target == null)
        {
            return;
        }
        if (_guidlist.index < 0 || _guidlist.index >= _guidlist.count)
        {
            return;
        }
        string path = AssetDatabase.GUIDToAssetPath(_guids[_guidlist.index]);

        if (typeof(T) == typeof(CornerDesign))
        {
            CornerDesign asset = (CornerDesign)AssetDatabase.LoadAssetAtPath(path, typeof(CornerDesign));
            if (asset == null)
            {
                return;
            }
            Undo.RecordObject(target, "Added CornerDesign to MappingObject");
            target.AddCorner(asset);
            //dirty target object
            EditorUtility.SetDirty(target);
        }
        else if (typeof(T) == typeof(LateralDesign))
        {
            LateralDesign asset = (LateralDesign)AssetDatabase.LoadAssetAtPath(path, typeof(LateralDesign));
            if (asset == null)
            {
                return;
            }
            Undo.RecordObject(target, "Added LatEdgeDesign to MappingObject");
            target.AddLateral(asset);
            //dirty target object
            EditorUtility.SetDirty(target);
        }
        else if (typeof(T) == typeof(LongitudeDesign))
        {
            LongitudeDesign asset = (LongitudeDesign)AssetDatabase.LoadAssetAtPath(path, typeof(LongitudeDesign));
            if (asset == null)
            {
                return;
            }
            Undo.RecordObject(target, "Added LongEdgeDesign to MappingObject");
            target.AddLongitude(asset);
            //dirty target object
            EditorUtility.SetDirty(target);
        }
        else if (typeof(T) == typeof(RectDesign))
        {
            RectDesign asset = (RectDesign)AssetDatabase.LoadAssetAtPath(path, typeof(RectDesign));
            if (asset == null)
            {
                return;
            }
            Undo.RecordObject(target, "Added RectFaceDesign to MappingObject");
            target.AddRect(asset);
            //dirty target object
            EditorUtility.SetDirty(target);
        }
        else if (typeof(T) == typeof(HexagonDesign))
        {
            HexagonDesign asset = (HexagonDesign)AssetDatabase.LoadAssetAtPath(path, typeof(HexagonDesign));
            if (asset == null)
            {
                return;
            }
            Undo.RecordObject(target, "Added HexagonFaceDesign to MappingObject");
            target.AddHexagon(asset);
            //dirty target object
            EditorUtility.SetDirty(target);
        }
        else
        {
            return;
        }
        _repaint_menu = true;
    }
예제 #3
0
    private void SwapSelected()
    {
        if (target == null)
        {
            return;
        }
        if (_guidlist.index < 0 || _guidlist.index >= _guidlist.count)
        {
            return;
        }
        if (_libobjlist.index < 0 || _libobjlist.index >= _libobjlist.count)
        {
            return;
        }
        string path = AssetDatabase.GUIDToAssetPath(_guids[_guidlist.index]);

        if (typeof(T) == typeof(CornerDesign))
        {
            CornerDesign asset = (CornerDesign)AssetDatabase.LoadAssetAtPath(path, typeof(CornerDesign));
            if (asset == null)
            {
                return;
            }
            Undo.RecordObject(target, "Replaced " + typeof(T).ToString() + "'s in MappingObject");
            target.ReplaceCorner((CornerDesign)_libobjs[_libobjlist.index], asset);
        }
        else if (typeof(T) == typeof(LateralDesign))
        {
            LateralDesign asset = (LateralDesign)AssetDatabase.LoadAssetAtPath(path, typeof(LateralDesign));
            if (asset == null)
            {
                return;
            }
            Undo.RecordObject(target, "Replaced " + typeof(T).ToString() + "'s in MappingObject");
            target.ReplaceLateral((LateralDesign)_libobjs[_libobjlist.index], asset);
        }
        else if (typeof(T) == typeof(LongitudeDesign))
        {
            LongitudeDesign asset = (LongitudeDesign)AssetDatabase.LoadAssetAtPath(path, typeof(LongitudeDesign));
            if (asset == null)
            {
                return;
            }
            Undo.RecordObject(target, "Replaced " + typeof(T).ToString() + "'s in MappingObject");
            target.ReplaceLongitude((LongitudeDesign)_libobjs[_libobjlist.index], asset);
        }
        else if (typeof(T) == typeof(RectDesign))
        {
            RectDesign asset = (RectDesign)AssetDatabase.LoadAssetAtPath(path, typeof(RectDesign));
            if (asset == null)
            {
                return;
            }
            Undo.RecordObject(target, "Replaced " + typeof(T).ToString() + "'s in MappingObject");
            target.ReplaceRect((RectDesign)_libobjs[_libobjlist.index], asset);
        }
        else if (typeof(T) == typeof(HexagonDesign))
        {
            HexagonDesign asset = (HexagonDesign)AssetDatabase.LoadAssetAtPath(path, typeof(HexagonDesign));
            if (asset == null)
            {
                return;
            }
            Undo.RecordObject(target, "Replaced " + typeof(T).ToString() + "'s in MappingObject");
            target.ReplaceHexagon((HexagonDesign)_libobjs[_libobjlist.index], asset);
        }
        else
        {
            return;
        }
        _repaint_menu = true;
        //dirty target object
        EditorUtility.SetDirty(target);
    }
예제 #4
0
 public void DeleteCornerPattern(CornerDesign corner, CornerPattern pattern)
 {
     _corner.DeletePattern(corner, pattern);
 }
예제 #5
0
 public bool CornerExists(CornerDesign corner)
 {
     return(_corner.ComponentExists(corner));
 }
예제 #6
0
 public void AddCornerPattern(CornerDesign corner, CornerPattern pattern)
 {
     _corner.AddPattern(corner, pattern);
 }
예제 #7
0
 public void DeleteCorner(CornerDesign corner)
 {
     _corner.DeleteComponent(corner);
 }
예제 #8
0
 public void ReplaceCorner(CornerDesign oldcorner, CornerDesign newcorner)
 {
     _corner.ReplaceComponent(oldcorner, newcorner);
 }
예제 #9
0
 public void AddCorner(CornerDesign corner)
 {
     _corner.AddComponent(corner);
 }
예제 #10
0
 public void AddCornerPatternsToList(CornerDesign corner, List <CornerPattern> list)
 {
     _corner.AddPatternsToList(corner, list);
 }