public static PresetDataSource SamplePresets() { PresetDataSource presets = new PresetDataSource(); presets.Push(new Preset(Preset.PresetType.Static, Pose.PresetPoseThinker(), "생각하는 사람", "로뎅")); presets.Push(new Preset(Preset.PresetType.Static, Pose.PresetPoseHeart(), "♡", "-/////-")); presets.Push(new Preset(Preset.PresetType.Static, Pose.PresetPoseOTL(), "OTL", "한송이")); presets.Push(new Preset(Preset.PresetType.Static, Pose.PresetPoseFashionKing(), "패숀왕", "쥬원")); presets.Push(new Preset(Preset.PresetType.Static, Pose.PresetPoseSillyWalker(), "A Silly Walker", "Paul")); return(presets); }
// Use this for initialization void Awake() { OnFlipComplete += () => {}; if (puppetPrefab == null) { Debug.LogError("puppetPrefab required"); } else { if (gameObject.name.StartsWith("Sample")) { presets = SamplePresets(); } else { presets = UserPresets(); } CreateSlots(); ApplyPresetsToSlots(); } }
const int RETRY_COUNT = 30; // allow sparse file index up to this public static PresetDataSource UserPresets() { PresetDataSource presets = new PresetDataSource(); int i = 0; int retryCount = RETRY_COUNT; while (retryCount > 0) { try { JSONClass json = (JSONClass)JSONClass.LoadFromFile(string.Format(GameController.SAVE_FILE_NAME_FORMAT, i)); Preset preset = Preset.Deserialize(json, i); presets.Push(preset); retryCount = RETRY_COUNT; } catch { retryCount--; } finally { i++; } } presets.Push(new Preset(Preset.PresetType.NewPresetPlaceHolder)); return(presets); }