protected virtual void Create(PlayTest playtest)
        {
            // TODO add more data validation

            if (string.IsNullOrEmpty(playtest.Title))
            {
                throw new ArgumentNullException("Please give a name to the play test");
            }

            if (playtest.ScenesToBuild.IsNullOrEmpty())
            {
                throw new ArgumentNullException("Please add a scene to test play test");
            }

            // Upload the con-fig
            try { ApiHandler.UploadPlayTestConfig(playtest); }
            catch
            {
                // TODO give a good error
                Debug.LogWarning("Could not connect to server.");
            }
            finally { CacheManager.AddPlayTest(playtest); }

            Cancel();
        }
        public CopyUIPanel(PlayTestToolkitWindow playTestToolkitWindow, PlayTest playtest) : base(playTestToolkitWindow)
        {
            newPlayTest        = Instantiate(playtest);
            newPlayTest.Active = false;
            serializedObject   = new SerializedObject(newPlayTest);

            create         = () => Create(newPlayTest);
            createAndBuild = () => CreateAndBuild(newPlayTest);
        }
        private static IList <EditorBuildSettingsScene> InitializeBuild(PlayTest playtest)
        {
            CacheManager.SetConfigPlayTest(playtest);

            IList <EditorBuildSettingsScene> scenesToBuild = GetPlayTestScenes(playtest);

            scenesToBuild.Insert(0, EntryPoint.Init(playtest));
            return(scenesToBuild);
        }
Example #4
0
        protected override void Create(PlayTest playtest)
        {
            // Update the con-fig on-line
            ApiHandler.UpdatePlayTestConfig(playtest);

            SafeAssetHandeling.SaveAsset(playtest);

            Cancel();
        }
        protected override void Create(PlayTest playtest)
        {
            playtest.Version = playtest.Collection.Playtests.Count;

            playtest.Id      = string.Empty;
            playtest.BuildId = string.Empty;

            base.Create(playtest);
        }
Example #6
0
        public EditUIPanel(PlayTestToolkitWindow playTestToolkitWindow, PlayTest playtest) : base(playTestToolkitWindow)
        {
            originalPlayTest = playtest;
            newPlayTest      = Instantiate(playtest);
            serializedObject = new SerializedObject(playtest);

            create         = () => Create(newPlayTest);
            createAndBuild = () => CreateAndBuild(originalPlayTest);
        }
        public void Awake()
        {
            playTestConfig = PlayTestToolkitSettings.PlayTestConfig;

            Init();

            InitRecorders(playTestConfig);

            LogRecorders();
        }
        public SetupUIPanel(PlayTestToolkitWindow playTestToolkitWindow) : base(playTestToolkitWindow)
        {
            newPlayTest = ScriptableObject.CreateInstance <PlayTest>();

            // TODO when switching scenes this will clear it self.
            serializedObject = new SerializedObject(newPlayTest);

            create         = () => Create(newPlayTest);
            createAndBuild = () => CreateAndBuild(newPlayTest);
        }
Example #9
0
    public void Awake()
    {
        test = GameObject.Find("Test").GetComponent <PlayTest>();
        if (this != Instance)
        {
            Destroy(this.gameObject);
            return;
        }

        DontDestroyOnLoad(this.gameObject);
    }
        private static void SetupScene(PlayTest playtest)
        {
            EntryPointSetup setup = Object.FindObjectOfType <EntryPointSetup>();

            if (!setup)
            {
                Debug.LogError("There is no entry point setup in the entry point scene");
                return;
            }

            setup.Init(playtest);
        }
Example #11
0
    public void Init(PlayTest playtest)
    {
        description.text         = Empty(playtest.Description);
        tutorialDescription.text = Empty(playtest.TutorialDescription);

        PopulateListObject(playtest.GameInput, tutorialInput);

        var recorders = playtest.Recorders.Where((s) => s.Active).ToList();

        PopulateListObject(recorders, dataCollectors);

        startButton.RemoveAllPresistentListener();
        startButton.onClick.AddPersistentListener(LoadPlayTest);
    }
        private static IList <EditorBuildSettingsScene> GetPlayTestScenes(PlayTest playtest)
        {
            IList <EditorBuildSettingsScene> newSettings = new List <EditorBuildSettingsScene>();

            EditorBuildSettingsScene sceneToAdd;

            // Get all scenes that have to be build
            foreach (SceneAsset sceneToBuild in playtest.ScenesToBuild)
            {
                sceneToAdd = new EditorBuildSettingsScene(AssetDatabase.GetAssetPath(sceneToBuild), true);
                newSettings.Add(sceneToAdd);
            }

            return(newSettings);
        }
        public static void UpdatePlayTestConfig(PlayTest playtest)
        {
            if (string.IsNullOrEmpty(playtest.Id))
            {
                return;
            }

            ConfigFile config = new ConfigFile(playtest);

            string data = JSONWriter.ToJson(config);

            string message = HttpActions.JsonAction(data, $"{API_CONFIG_ROUTE}/{playtest.Id}", "PUT");

            Debug.Log(message);
        }
        protected void CreateAndBuild(PlayTest playtest)
        {
            Create(playtest);

            bool buildSucces = Builder.Build(playtest);

            if (buildSucces)
            {
                ApiHandler.UpdatePlayTestConfig(playtest);

                SafeAssetHandeling.SaveAsset(playtest);
                return;
            }

            // TODO populate with good error codes
            EditorUtility.DisplayDialog("Error", "Something went wrong.", "Ok");
        }
        public static void UploadPlayTestConfig(PlayTest playtest)
        {
            if (!string.IsNullOrEmpty(playtest.Id))
            {
                return;
            }

            ConfigFile config = new ConfigFile(playtest);

            string data = JSONWriter.ToJson(config);

            string message = HttpActions.JsonAction(data, API_CONFIG_ROUTE);

            Debug.Log(message);

            playtest.Id = JSONParser.FromJson <ConfigFile>(message).Id;
        }
Example #16
0
    /// <summary>
    /// シーン遷移用コルーチン .
    /// </summary>
    /// <param name='scene'>シーン名</param>
    /// <param name='interval'>暗転にかかる時間(秒)</param>
    private IEnumerator TransScene(string scene, float interval, int lestTime)
    {
        //だんだん暗く .

        this.isFading = true;
        float time = 0;

        while (time <= interval)
        {
            this.fadeAlpha = Mathf.Lerp(0f, 1f, time / interval * 2);
            time          += Time.deltaTime;
            yield return(0);
        }

        float nextTime = 0;

        while (nextTime <= lestTime)
        {
            if (next)
            {
                nextTime = lestTime;
            }
            nextTime += Time.deltaTime;
            yield return(null);
        }
        //シーン切替 .
        SceneManager.LoadScene(scene);

        //だんだん明るく .
        time = 0;
        while (time <= interval)
        {
            this.fadeAlpha = Mathf.Lerp(1f, 0f, time / interval * 2);
            time          += Time.deltaTime;
            yield return(0);
        }

        this.isFading = false;
        next          = false;
        if (GameObject.Find("Test") == true)
        {
            test = GameObject.Find("Test").GetComponent <PlayTest>();
        }
    }
Example #17
0
    private void FixedUpdate()
    {
        if (Input.GetKeyDown(KeyCode.M))
        {
            mode = mode == PlayTest.velocityMode ? PlayTest.positionMode : PlayTest.velocityMode;
        }


        //RotatePlayer();

        if (mode == PlayTest.velocityMode)
        {
            MovePlayerVelocity();
        }
        else
        {
            MovePlayerPosition();
        }
    }
        private void InitRecorders(PlayTest playTestConfig)
        {
            foreach (BaseRecorder collector in playTestConfig.Recorders)
            {
                if (!collector.Active)
                {
                    continue;
                }

                switch (collector)
                {
                case InputRecorder recorder:
                    recorders.Add(new InputRecorder(playTestConfig.GameInput.Select(e => e.Key).ToList()));
                    break;

                default:
                    Debug.LogWarning("No recorders found!");
                    break;
                }
            }
        }
        public static EditorBuildSettingsScene Init(PlayTest playtest)
        {
            EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo();

            IEnumerator <Scene> enumerator = SceneManagementExtension.GetAllLoadedScenes().GetEnumerator();

            enumerator.MoveNext();
            string lastScene = enumerator.Current.path;

            EditorBuildSettingsScene entryPointScene = GetSceneByName(PlayTestToolkitSettings.ENTRY_POINT_SCENE);

            EditorSceneManager.OpenScene(entryPointScene.path, OpenSceneMode.Single);

            SetupScene(playtest);

            EditorSceneManager.MarkAllScenesDirty();
            EditorSceneManager.SaveOpenScenes();

            EditorSceneManager.OpenScene(lastScene, OpenSceneMode.Single);

            return(entryPointScene);
        }
Example #20
0
        private static void loadNewMode(OsuMode newMode)
        {
            //Create the actual mode
            GameMode mode = null;

            switch (newMode)
            {
            case OsuMode.MainMenu:
                mode = new MainMenu();
                break;

            case OsuMode.SongSelect:
                mode = new SongSelectMode();
                break;

            case OsuMode.Results:
                mode = new Results();
                break;

#if MONO
            case OsuMode.PlayTest:
                mode = new PlayTest();
                break;
#endif
            case OsuMode.Play:
                if (CurrentOsuMode == OsuMode.VideoPreview)
                {
                    mode = new PreviewPlayer();
                }
                else
                {
                    mode = new Player();
                }
                break;

            case OsuMode.Store:
#if iOS
                mode = new StoreModeIphone();
#else
                mode = new StoreMode();
#endif
                break;

            case OsuMode.Options:
                mode = new Options();
                break;

            case OsuMode.Tutorial:
                mode = new Tutorial();
                break;

            case OsuMode.Credits:
                mode = new Credits();
                break;

            case OsuMode.VideoPreview:
                mode = new VideoPreview();
                break;

            case OsuMode.Empty:
                mode = new Empty();
                break;

#if MONO
            case OsuMode.PositioningTest:
                mode = new PositioningTest();
                break;
#endif
            }

            PendingMode = mode;
        }
        public static void DeletePlayTestConfig(PlayTest playtest)
        {
            string message = HttpActions.JsonAction("", $"{API_CONFIG_ROUTE}/{playtest.Id}", "DELETE");

            Debug.Log(message);
        }
        public static bool Build(PlayTest playtest)
        {
            string zipPath = playtest.ZipPath;

            if (string.IsNullOrEmpty(zipPath))
            {
                if (!EditorUtility.DisplayDialog("Start build",
                                                 "This will start a build of your game. Are you sure you want to do this now?",
                                                 "Yes",
                                                 "No"))
                {
                    return(false);
                }

                IList <EditorBuildSettingsScene> scenesToBuild = InitializeBuild(playtest);

                string playTestTitle = playtest.Title.OnlyLettersAndNumbers();
                string versionName   = $"{playTestTitle}V{playtest.Version}";

                string exePath = CreatePath(playTestTitle, versionName, $"{versionName}.exe");

                if (!BuildPlayTest(exePath, scenesToBuild))
                {
                    return(false);
                }

                EditorUtility.DisplayProgressBar("Zipping", "Zipping the build before uploading.", 0f);

                string folderPath = CreatePath(playTestTitle, versionName, string.Empty);
                zipPath = CreatePath(playTestTitle, string.Empty, $"{versionName}.zip");

                if (File.Exists(zipPath))
                {
                    File.Delete(zipPath);
                }

                ZipFile.CreateFromDirectory(folderPath, zipPath);

                playtest.ZipPath = zipPath;

                EditorUtility.ClearProgressBar();
            }

            EditorUtility.DisplayProgressBar("Uploading", "Upload of build in progress.", 0f);

            bool uploadSuccedded = ApiHandler.UploadZip(zipPath, out string buildId);

            EditorUtility.ClearProgressBar();

            playtest = Runtime.CacheManager.GetPlayTestConfig();

            if (!uploadSuccedded)
            {
                return(false);
            }

            playtest.Active  = true;
            playtest.BuildId = buildId;

            return(true);
        }
Example #23
0
        private static void checkOverlaps(Difficulty s1, Difficulty s2, int switchTime = 0)
        {
            bool streamSwitch = s2 != Difficulty.None;

            PlayTest.AllowStreamSwitch = streamSwitch;

            PlayTest.StartTime = switchTime > 0 ? switchTime - 10000 : 0;
            int endTime = switchTime > 0 ? switchTime + 10000 : 0;

            PlayTest.InitialDifficulty = s1;

            Player.Autoplay = true;

            if (s2 > s1)
            {
                PlayTest.InitialHp = 200;
            }
            else
            {
                PlayTest.InitialHp = 0;
            }

            using (PlayTest p = new PlayTest())
            {
                p.Initialize();

                FakeAudioTimeSource source = new FakeAudioTimeSource();
                source.InternalTime   = Math.Max((PlayTest.StartTime - 10000) / 1000f, 0);
                Clock.AudioTimeSource = source;

                HitObjectManager hitObjectManager = p.HitObjectManager;

                List <HitObjectPair> pairs = new List <HitObjectPair>();

                while ((switchTime == 0 && p.Progress < 1) || Clock.AudioTime < switchTime + 10000)
                {
                    if (source.InternalTime % 20 < 0.01)
                    {
                        Console.Write(".");
                    }

                    Clock.UpdateCustom(0.01);
                    source.InternalTime += 0.01;

                    List <HitObject> objects = hitObjectManager.ActiveStreamObjects.FindAll(h => h.IsVisible);
                    foreach (HitObject h1 in objects)
                    {
                        foreach (HitObject h2 in objects)
                        {
                            if (h1 == h2)
                            {
                                continue;
                            }

                            HitObjectPair hop = new HitObjectPair(h1, h2);

                            if (pairs.IndexOf(hop) >= 0)
                            {
                                continue;
                            }

                            //hack in the current snaking point for added security.
                            Vector2 h1pos2 = h1 is Slider ? ((Slider)h1).SnakingEndPosition : h1.Position2;
                            Vector2 h2pos2 = h2 is Slider ? ((Slider)h2).SnakingEndPosition : h2.Position2;

                            if (pMathHelper.Distance(h1.Position, h2.Position) < DifficultyManager.HitObjectRadiusSprite ||
                                pMathHelper.Distance(h1.Position, h2pos2) < DifficultyManager.HitObjectRadiusSprite ||
                                pMathHelper.Distance(h1pos2, h2.Position) < DifficultyManager.HitObjectRadiusSprite ||
                                pMathHelper.Distance(h1pos2, h2pos2) < DifficultyManager.HitObjectRadiusSprite)
                            {
                                pairs.Add(hop);
                                if (s2 != Difficulty.None)
                                {
                                    Console.WriteLine("[mod] [{1}->{2}] Overlap at {0}", Clock.AudioTime, s1.ToString()[0], s2.ToString()[0]);
                                }
                                else
                                {
                                    Console.WriteLine("[mod] [{1}] Overlap at {0}", Clock.AudioTime, s1, s2);
                                }
                            }
                        }
                    }
                }
            }
        }