Ejemplo n.º 1
0
    private void StartGame()
    {
        // showing interstitial
        if (lastAddsTime + gameSettings.interstitialShowingDelay < Time.realtimeSinceStartup)
        {
            AdsManager.ShowInterstitial(interstitialType);

            lastAddsTime = Time.realtimeSinceStartup;
        }

        reviveUsed           = false;
        firstStageCompleted  = false;
        currentItemsAbsorbed = 0;
        currentLevel         = GameSettingsPrefs.Get <int>("current level");

        levelState = LevelState.First;
        LevelController.instance.LoadLevel(currentLevel);
        UIController.instance.InitLevel(currentLevel);
        CameraController.instance.InitCameraOnFirstStage();
        ColorsController.SetRandomPreset();

        GroundGenerator.InitPlayground();

        waitingForTap = true;

        // ads
        bannerType        = AdsManager.GetBannerType();
        interstitialType  = AdsManager.GetInterstitialType();
        rewardedVideoType = AdsManager.GetRewardedVideoType();

        AdsManager.RequestInterstitial(interstitialType);
        AdsManager.RequestRewardBasedVideo(rewardedVideoType);

        AdsManager.ShowBanner(bannerType);
    }
Ejemplo n.º 2
0
    private void Awake()
    {
        instance        = this;
        emissionColorID = Shader.PropertyToID("_EmissionColor");

        presetsList.Shuffle();
    }
Ejemplo n.º 3
0
 public void LoadCurrent(ColorsController controller)
 {
     hasUnsavedChanges = false;
     if (controller.currentPresetEditor != null)
     {
         controller.SetPreset(controller.currentPresetEditor);
     }
     else
     {
         Debug.Log("Please, assign current preset");
     }
 }
Ejemplo n.º 4
0
        public Get()
        {
            _color = new ColorDetail
            {
                Name = "Color"
            };

            _colorServiceMock = new Mock <IColorService>();
            _colorServiceMock.Setup(x => x.Get(It.IsAny <int>()))
            .Returns(() => _color);
            _colorServiceMock.Setup(x => x.Get(-1))
            .Returns(() => null);

            _controller = new ColorsController(_colorServiceMock.Object);
        }
Ejemplo n.º 5
0
        public GetAll()
        {
            _colors = new List <ColorDetail>
            {
                new ColorDetail
                {
                    Name = "test"
                }
            };

            _colorServiceMock = new Mock <IColorService>();
            _colorServiceMock.Setup(x => x.GetAll())
            .Returns(() => _colors);

            _controller = new ColorsController(_colorServiceMock.Object);
        }
Ejemplo n.º 6
0
    public void SaveToCurrent(ColorsController controller)
    {
        hasUnsavedChanges = false;
        if (controller.currentPresetEditor != null)
        {
            controller.currentPresetEditor.item     = GetMaterialSave(controller.itemMaterial);
            controller.currentPresetEditor.obstacle = GetMaterialSave(controller.obstacleMaterial);
            controller.currentPresetEditor.ground   = GetMaterialSave(controller.groundMaterial);
            controller.currentPresetEditor.borders  = GetMaterialSave(controller.bordersMaterial);
            controller.currentPresetEditor.backSea  = GetMaterialSave(controller.backSeaMaterial);

            EditorUtility.SetDirty(controller.currentPresetEditor);
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }
        else
        {
            Debug.Log("Please, assign current preset");
        }
    }
        public void GetColorsDescendingOrderTest()
        {
            // Arrange
            var serviceMock = new Mock <IColorsService>();

            serviceMock.Setup(arg => arg.GetColors(5)).Returns(
                new List <ColorsDTO>
            {
                new ColorsDTO {
                    Id = 1
                },
                new ColorsDTO {
                    Id = 8
                },
                new ColorsDTO {
                    Id = 5
                },
                new ColorsDTO {
                    Id = 2
                },
                new ColorsDTO {
                    Id = 4
                }
            });

            var controller = new ColorsController(serviceMock.Object);

            // Act
            var result      = controller.GetColors(5, true) as PartialViewResult;
            var colorsArray = ((IEnumerable <ColorModel>)result.ViewData.Model).ToArray();

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(5, colorsArray.Length);
            Assert.AreEqual(8, colorsArray[0].Id);
            Assert.AreEqual(1, colorsArray[4].Id);
        }
Ejemplo n.º 8
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        base.OnInspectorGUI();
        GUILayout.Space(5);

        controller = target as ColorsController;

        controller.itemMaterial = DrawMaterialAndColorEditor("Item", controller.itemMaterial);
        GUILayout.Space(8);
        controller.obstacleMaterial = DrawMaterialAndColorEditor("Obstacle", controller.obstacleMaterial);
        GUILayout.Space(8);
        controller.groundMaterial = DrawMaterialAndColorEditor("Ground", controller.groundMaterial);
        GUILayout.Space(8);
        controller.bordersMaterial = DrawMaterialAndColorEditor("Borders", controller.bordersMaterial);
        GUILayout.Space(8);
        controller.backSeaMaterial = DrawMaterialAndColorEditor("Back Sea", controller.backSeaMaterial);

        GUILayout.Space(10);

        GUILayout.Label("Developement", boldSyle);

        if (!presetCreation)
        {
            EditorGUILayout.BeginHorizontal();
            controller.currentPresetEditor = (ColorsPreset)EditorGUILayout.ObjectField("Current Preset: ", controller.currentPresetEditor, typeof(ColorsPreset), true);

            if (GUILayout.Button("New"))
            {
                presetCreation = true;
            }

            GUILayout.EndHorizontal();

            //if (hasUnsavedChanges)
            //{
            //    GUILayout.Space(10);

            //    EditorGUILayout.HelpBox("There is unsaved changes", MessageType.Warning);
            //}

            GUILayout.Space(10);

            if (EditorApplication.isPlaying)
            {
                GUILayout.BeginHorizontal();

                if (GUILayout.Button("◀", GUILayout.Height(20)))
                {
                    if (hasUnsavedChanges)
                    {
                        if (EditorUtility.DisplayDialog("There is unsaved changes", "All changes will be lost", "Discard changes", "Cancel"))
                        {
                            hasUnsavedChanges = false;
                            ColorsController.EditorSetRandomPresetInverse();
                        }
                    }
                    else
                    {
                        ColorsController.EditorSetRandomPresetInverse();
                    }
                }

                if (GUILayout.Button("▶", GUILayout.Height(20)))
                {
                    if (hasUnsavedChanges)
                    {
                        if (EditorUtility.DisplayDialog("There is unsaved changes", "All changes will be lost", "Discard changes", "Cancel"))
                        {
                            hasUnsavedChanges = false;
                            ColorsController.SetRandomPreset();
                        }
                    }
                    else
                    {
                        ColorsController.SetRandomPreset();
                    }
                }

                GUILayout.EndHorizontal();
            }

            GUILayout.BeginHorizontal();

            if (GUILayout.Button("Load current", GUILayout.Height(30), GUILayout.Width(EditorGUIUtility.currentViewWidth * 0.463f)))
            {
                LoadCurrent(controller);
            }

            if (GUILayout.Button((hasUnsavedChanges ? "*" : "") + "Save to current", GUILayout.Height(30), GUILayout.Width(EditorGUIUtility.currentViewWidth * 0.463f)))
            {
                SaveToCurrent(controller);
            }
            GUILayout.EndHorizontal();
        }
        else
        {
            newPresetName = EditorGUILayout.TextField("Preset Name: ", newPresetName);

            GUILayout.Space(10);

            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button("Cancel", GUILayout.Height(30)))
            {
                presetCreation = false;
                newPresetName  = string.Empty;
            }

            if (GUILayout.Button("Create", GUILayout.Height(30)))
            {
                controller.currentPresetEditor = ScriptableObject.CreateInstance <ColorsPreset>();
                AssetDatabase.CreateAsset(controller.currentPresetEditor, PRESETS_PATH + (newPresetName == string.Empty ? "NewPreset" : newPresetName) + ".asset");
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();

                presetCreation = false;
            }

            GUILayout.EndHorizontal();
        }

        serializedObject.ApplyModifiedProperties();
    }
Ejemplo n.º 9
0
 public static void ChangeColorPreset()
 {
     ColorsController.SetRandomPreset();
 }
Ejemplo n.º 10
0
 private void ColorCompoBox_Load(object sender, EventArgs e)
 {
     controller = new ColorsController();
     controller.Setup2(this.label1, this.label2, this.label3, this.label4);
     controller.Setup1(this.trackR, this.trackG, this.trackB, this.trackA, this.pnlView);
 }
Ejemplo n.º 11
0
 // Start est appelé sur le cadre lorsqu'un script est activé jour ne soit appelée pour la première fois.
 void Start()
 {
     colorsController = GameObject.FindObjectOfType <ColorsController>();
 }