Example #1
0
        public Rail(LevelIO.ObjectInfo info, SM3DWorldZone zone, out bool loadLinks)
            : base(PathPointsFromRailPointsEntry(info.PropertyEntries["RailPoints"]))
        {
            ID = info.ID;
            if (zone != null)
            {
                zone.SubmitRailID(ID);
            }

            ObjType = (RailObjType)Enum.Parse(typeof(RailObjType), info.ClassName);

            if (ObjType == RailObjType.RailWithMoveParameter)
            {
                IsReverseCoord = info.PropertyEntries["IsReverseCoord"].Parse();
            }


            IsLadder = info.PropertyEntries["IsLadder"].Parse();

            Closed = info.PropertyEntries["IsClosed"].Parse();

            zone?.SubmitRailID(ID);

            loadLinks = false; //We don't expect Rails to have Links
        }
Example #2
0
        public ZonePlacement(Vector3 pos, Vector3 rot, Vector3 scale, SM3DWorldZone zone)
            : base(pos, rot, scale)
        {
            Zone = zone;

            Zone.UpdateRenderBatch();
        }
Example #3
0
        /// <summary>
        /// Creates a blank SM3DW Scene
        /// </summary>
        public SM3DWorldScene(SM3DWorldZone zone)
        {
            mainZone = zone;

            multiSelect = true;

            StaticObjects.Add(new LinkRenderer(this));
        }
Example #4
0
        public ZonePlacement(Vector3 pos, Vector3 rot, string layer, SM3DWorldZone zone)
            : base(pos)
        {
            Rotation = rot;

            Layer = layer;

            Zone = zone;

            Zone.UpdateRenderBatch();
        }
Example #5
0
        private void FilterZonesCheckbox_CheckedChanged(object sender, EventArgs e)
        {
            zoneInfos.Clear();

            foreach (string filePath in Directory.EnumerateFiles(Program.BaseStageDataPath))
            {
                if (SM3DWorldZone.TryGetStageInfo(filePath, out StageInfo? _stageInfo))
                {
                    StageInfo stageInfo = _stageInfo.Value;

                    if (FilterZonesCheckbox.Checked && !stageInfo.StageName.EndsWith("Zone"))
                    {
                        continue;
                    }

                    stageInfo.StageArcType = StageArcType.NotSpecified;

                    zoneInfos.Add(stageInfo);
                }
            }

            if (currentDirectory != Program.BaseStageDataPath)
            {
                foreach (string filePath in Directory.EnumerateFiles(currentDirectory))
                {
                    if (SM3DWorldZone.TryGetStageInfo(filePath, out StageInfo? _stageInfo))
                    {
                        StageInfo stageInfo = _stageInfo.Value;

                        if (FilterZonesCheckbox.Checked && !stageInfo.StageName.EndsWith("Zone"))
                        {
                            continue;
                        }

                        zoneInfos.Remove(new StageInfo(Program.BaseStageDataPath, stageInfo.StageName));

                        stageInfo.StageArcType = StageArcType.NotSpecified;

                        zoneInfos.Add(stageInfo);
                    }
                }
            }

            SearchTextBox_TextChanged(null, null);
        }
Example #6
0
        public static bool Redo(out SM3DWorldZone zoneToFocus)
        {
            if (index != currentZoneHistory.Count - 1)
            {
                if (lastAction == ActionType.REDO)
                {
                    index++;
                }

                zoneToFocus = currentZoneHistory[index];
                lastAction  = ActionType.REDO;
                return(true);
            }
            else
            {
                zoneToFocus = null;
                return(false);
            }
        }
Example #7
0
        public static bool Undo(out SM3DWorldZone zoneToFocus)
        {
            if (index != 0)
            {
                if (lastAction == ActionType.UNDO)
                {
                    index--;
                }

                zoneToFocus = currentZoneHistory[index];
                lastAction  = ActionType.UNDO;
                return(true);
            }
            else
            {
                zoneToFocus = null;
                return(false);
            }
        }
        /// <summary>
        /// Cast an Object Parameter to a new General 3DW Object with mostly empty values
        /// </summary>
        /// <param name="ID">The ID to give the object.<para/>Can also use <see cref="SM3DWorldScene.NextObjID()"/></param>
        /// <param name="ObjectNameID">For Classes that have multiple Object Names. default is 0</param>
        /// <param name="ModelNameID">For Classes that have multiple Model Names. Default is -1 (No Model Name)</param>
        /// <returns>new General 3DW Object</returns>
        public virtual General3dWorldObject ToGeneral3DWorldObject(string ID, SM3DWorldZone zone, OpenTK.Vector3 Position, int ObjectNameID = 0, int ModelNameID = -1)
        {
            Dictionary <string, dynamic> Params = new Dictionary <string, dynamic>();

            for (int i = 0; i < Properties.Count; i++)
            {
                switch (Properties[i].Value)
                {
                case "Integer":
                    Params.Add(Properties[i].Key, 0);
                    break;

                case "Float":
                    Params.Add(Properties[i].Key, 0.0f);
                    break;

                case "Boolean":
                    Params.Add(Properties[i].Key, false);
                    break;

                case "Null":
                case "String":
                    Params.Add(Properties[i].Key, "");
                    break;
                }
            }

            Dictionary <string, List <I3dWorldObject> > Links = new Dictionary <string, List <I3dWorldObject> >();

            for (int i = 0; i < LinkNames.Count; i++)
            {
                Links.Add(LinkNames[i], new List <I3dWorldObject>());
            }


            return(new General3dWorldObject(Position, new OpenTK.Vector3(0f), new OpenTK.Vector3(1f), ID, ObjectNames[ObjectNameID], ModelNameID == -1 ? "" : ModelNames[ModelNameID], ClassName, new OpenTK.Vector3(0f), new OpenTK.Vector3(0f), new OpenTK.Vector3(1f), Links, Params, zone));
        }
Example #9
0
 public static void Submit(SM3DWorldZone currentZone)
 {
     currentZoneHistory.Add(currentZone);
     index++;
     lastAction = ActionType.SUBMIT;
 }
Example #10
0
 public ZonePlacement(Vector3 pos, Vector3 rot, Vector3 scale, SM3DWorldZone zone)
     : base(pos, rot, scale)
 {
     this.Zone = zone;
 }
Example #11
0
 /// <summary>
 /// Creates a new rail for 3DW
 /// </summary>
 /// <param name="pathPoints">List of Path Points to use in this rail</param>
 /// <param name="iD">ID Of the rail</param>
 /// <param name="isClosed">Is the path closed?</param>
 /// <param name="isLadder">Unknown</param>
 /// <param name="isReverseCoord">Reverses the order the rails are in</param>
 /// <param name="railObjType"><see cref="RailObjType"/></param>
 public Rail(List <PathPoint> pathPoints, string iD, bool isClosed, bool isLadder, bool isReverseCoord, RailObjType railObjType, SM3DWorldZone zone)
     : base(pathPoints)
 {
     ID             = iD;
     Closed         = isClosed;
     IsLadder       = isLadder;
     IsReverseCoord = isReverseCoord;
     ObjType        = railObjType;
     zone?.SubmitRailID(ID);
 }
        //abstract public string ListName { get; }

        public abstract bool TryGetObjectList(SM3DWorldZone zone, out ObjectList objList);