コード例 #1
0
        void Start()
        {
            Console.WriteLine("[SpinSaber] SpinSaberBehaviour initialized!");
            playerController = FindObjectOfType <PlayerController>();
            if (playerController == null)
            {
                Console.WriteLine("[SpinSaber] Failed to find PlayerController on SpinSaberBehaviour load!");
                enabled = false;
                return;
            }
            else
            {
                Console.WriteLine("[SpinSaber] Found PlayerController!");

                config = Plugin.LoadedConfig;
                if (config == null)
                {
                    Console.WriteLine("[SpinSaber] No valid selected SpinConfig!");
                    enabled = false;
                    return;
                }

                StartCoroutine(SpinnyBoi());
            }
        }
コード例 #2
0
ファイル: Plugin.cs プロジェクト: JonnyXDA/SpinSaber
        public SpinConfig[] SerializeExampleConfigs()
        {
            SpinConfig[] examples = new SpinConfig[3];

            examples[0]           = new SpinConfig();
            examples[0]           = new SpinConfig();
            examples[0].name      = "SpinExample";
            examples[0].bpmFactor = 0;
            examples[0].periods   = new SpinConfig.SpinConfigPeriod[] {
                new SpinConfig.SpinConfigPeriod(24, Swingers.Swinger.Type.NONE, 0, new Vector3(0, 0, 0), new Vector3(0, 360, 0)) //15° per second
            };

            examples[1]           = new SpinConfig();
            examples[1].name      = "SwingExample";
            examples[1].bpmFactor = 0;
            examples[1].periods   = new SpinConfig.SpinConfigPeriod[] {
                new SpinConfig.SpinConfigPeriod(5, Swingers.Swinger.Type.EASE_IN_OUT_QUADRATIC, 0, new Vector3(0, -45, 0), new Vector3(0, 45, 0)),
                new SpinConfig.SpinConfigPeriod(5, Swingers.Swinger.Type.EASE_IN_OUT_QUADRATIC, 0, new Vector3(0, 45, 0), new Vector3(0, -45, 0))
            };
            loadedConfigs.Add(examples[1]);

            examples[2]           = new SpinConfig();
            examples[2].name      = "SwingWaitEx";
            examples[2].bpmFactor = 0;
            examples[2].periods   = new SpinConfig.SpinConfigPeriod[] {
                new SpinConfig.SpinConfigPeriod(5, Swingers.Swinger.Type.EASE_IN_OUT_QUADRATIC, 0, new Vector3(0, -45, 0), new Vector3(0, 45, 0)),
                new SpinConfig.SpinConfigPeriod(2, Swingers.Swinger.Type.NONE, 0, new Vector3(0, 45, 0), new Vector3(0, 45, 0)),
                new SpinConfig.SpinConfigPeriod(5, Swingers.Swinger.Type.EASE_IN_OUT_QUADRATIC, 0, new Vector3(0, 45, 0), new Vector3(0, -45, 0)),
                new SpinConfig.SpinConfigPeriod(2, Swingers.Swinger.Type.NONE, 0, new Vector3(0, -45, 0), new Vector3(0, -45, 0)),
            };
            loadedConfigs.Add(examples[2]);

            foreach (SpinConfig config in examples)
            {
                string filePath = Environment.CurrentDirectory.Replace('\\', '/') + "/UserData/SpinSaber/" + config.name + ".xml";

                if (File.Exists(filePath))
                {
                    continue;                        //File.Delete(filePath);
                }
                using (StreamWriter w = File.AppendText(filePath)) {
                    XmlSerializer ser = new XmlSerializer(config.GetType());
                    ser.Serialize(w, config);
                }
            }

            return(examples);
        }