internal int GetObjectID(PresetsRecord loadedPreset) { if (loadedPreset == null || !PresetExist(loadedPreset)) { return(-1); } return(PresetsGOList.IndexOf(loadedPreset)); }
public void RemovePreset(string presetName) { PresetsRecord presetToDelete = FindPresetByName(presetName); if (presetToDelete == null) { throw new Exception(MSG.Errors.PRESET_DELETE_NOT_EXIST); } PresetsGOList.Remove(presetToDelete); Save(); }
public int GetIDByName(string presetName) { PresetsRecord x = FindPresetByName(presetName); if (x != null) { return(GetObjectID(x)); } else { return(-1); } }
private static bool PresetExist(List <PresetsRecord> list, PresetsRecord presetRecord) { if (list.Count == 0) { return(false); } for (int i = 0; i < list.Count; i++) { if (list[i].IsTheSame(presetRecord)) { return(true); } } return(false); }
public static QuickPolygon CreateFromLastPreset(string name, MeshType meshIndex, Vector3 position, Quaternion rotation, bool isUI) { PresetsRecord lastPreset = PresetsManager.GetLastUsedPreset(); QuickPolygon mesh = Create(name, meshIndex, position, rotation, isUI); if (lastPreset != null && PresetsManager.IsPresetExists(lastPreset)) { PresetsManager.LoadPresetFor(lastPreset, mesh); } else { Debug.LogWarning(MSG.Warnings.PRESET_LAST_NOT_FOUND); } mesh.RecalculateMesh(); return(mesh); }
public bool IsTheSame(PresetsRecord p) { if (this.name != p.name) { return(false); } if (this.meshType != p.meshType) { return(false); } if (this.polySerialised != p.polySerialised) { return(false); } return(true); }
public static void SavePreset(string presetName, QuickPolygon shape) { PresetsRecord presetRecord = presetsContainer.FindPresetByName(presetName); if (presetRecord == null) { presetRecord = new PresetsRecord(presetName, shape); presetsContainer.AddNewRecord(presetRecord); } else { presetRecord.Update(shape); presetsContainer.Save(); } shape.CurrentPresetName = presetName; RefreshPresetContainer(); }
public static string GetMostUsedPreset() { if (presetsContainer == null || presetsContainer.PresetsGOList.Count < 1) { RefreshPresetContainer(); } PresetsRecord mostUsedRecord = presetsContainer.GetMostUsedPreset(); if (mostUsedRecord != null) { return(mostUsedRecord.polySerialised); } else { return(""); } }
public static void LoadPresetFor(PresetsRecord presetRecord, QuickPolygon shape, bool loadMesh = false) { if (presetRecord == null) { throw new Exception(MSG.Errors.PRESET_LOAD_NOT_EXIST); } else { lastGOpreset = presetsContainer.GetObjectID(presetRecord); presetRecord.timesUsed++; SerializationClass.Deserialize(shape, presetRecord.polySerialised, shape.AllowLoadPresetGeometry); shape.CurrentPresetName = presetRecord.name; if (loadMesh) { shape.ShapeMeshIndex = (MeshType)presetRecord.meshType; } } }
public static void LoadPresetFor(string presetName, QuickPolygon shape, bool loadMesh = false) { PresetsRecord loadedPreset = presetsContainer.FindPresetByName(presetName); LoadPresetFor(loadedPreset, shape, loadMesh); }
public static bool IsPresetExists(PresetsRecord presetsRecord) { return(presetsContainer.PresetExist(presetsRecord)); }
public void AddNewRecord(PresetsRecord presetRecord) { PresetsGOList.Add(presetRecord); this.Save(); }
public bool PresetExist(PresetsRecord preset) { return(PresetExist(PresetsGOList, preset)); }