Пример #1
0
    void createNewSplash(SplashImages myTarget)
    {
        BaseImage[] rz    = myTarget.GetComponentsInChildren <BaseImage>(true);
        GameObject  go    = new GameObject();
        int         count = rz.Length + 1;

        go.name = "Splash" + count;

        go.transform.parent = myTarget.transform;



        BaseImage newRound = go.AddComponent <BaseImage>();

        List <BaseImage> rounds = new List <BaseImage>();

        for (int i = 0; i < myTarget.splashImages.Length; i++)
        {
            rounds.Add(myTarget.splashImages[i]);
        }
        rounds.Add(newRound);
        myTarget.splashImages = rounds.ToArray();

        myTarget.splashIndex = myTarget.splashImages.Length - 1;

        serializedObject.ApplyModifiedProperties();
        EditorUtility.SetDirty(myTarget);
    }
Пример #2
0
    public override void OnInspectorGUI()
    {
        SplashImages myTarget = (SplashImages)target;

        EditorGUILayout.Separator();
        serializedObject.Update();


        handleRounds(myTarget);


        serializedObject.ApplyModifiedProperties();
        EditorUtility.SetDirty(target);
    }
    void deleteSplash(SplashImages myTarget)
    {
        if(myTarget.splashIndex>-1 && myTarget.splashIndex < myTarget.splashImages.Length	)
        {
            DestroyImmediate(myTarget.splashImages[myTarget.splashIndex].gameObject);
        }
        List<BaseImage> rounds = new List<BaseImage>();
        for(int i=0; i<myTarget.splashImages.Length; i++)
        {
            if(myTarget.splashImages[i])
            {
                rounds.Add(myTarget.splashImages[i]);
            }
        }
        myTarget.splashImages = rounds.ToArray();

        myTarget.splashIndex = myTarget.splashImages.Length-1;

        serializedObject.ApplyModifiedProperties();
        EditorUtility.SetDirty(myTarget);
    }
Пример #4
0
    void deleteSplash(SplashImages myTarget)
    {
        if (myTarget.splashIndex > -1 && myTarget.splashIndex < myTarget.splashImages.Length)
        {
            DestroyImmediate(myTarget.splashImages[myTarget.splashIndex].gameObject);
        }
        List <BaseImage> rounds = new List <BaseImage>();

        for (int i = 0; i < myTarget.splashImages.Length; i++)
        {
            if (myTarget.splashImages[i])
            {
                rounds.Add(myTarget.splashImages[i]);
            }
        }
        myTarget.splashImages = rounds.ToArray();

        myTarget.splashIndex = myTarget.splashImages.Length - 1;

        serializedObject.ApplyModifiedProperties();
        EditorUtility.SetDirty(myTarget);
    }
Пример #5
0
    void handleRounds(SplashImages myTarget)
    {
        EditorGUILayout.LabelField("Splash Images");
        if (GUILayout.Button("New Splash"))
        {
            createNewSplash(myTarget);
        }
        if (GUILayout.Button("Delete current"))
        {
            deleteSplash(myTarget);
        }
        EditorGUILayout.IntSlider(serializedObject.FindProperty("splashIndex"), 0, myTarget.splashImages.Length - 1);

        float fround    = (float)myTarget.splashIndex;
        float nomRounds = (float)myTarget.splashImages.Length - 1;
        float val       = fround / nomRounds;

        ProgressBar(val, "Splash");


        if (myTarget.splashImages.Length > 0 && myTarget.splashIndex > -1)
        {
            BaseImage round = myTarget.splashImages[myTarget.splashIndex];
            if (round)
            {
                if (round.fadeType == BaseImage.FadeType.FADE)
                {
                    handleFade(round);
                }
                if (round.fadeType == BaseImage.FadeType.SPLASH)
                {
                    handleSplash(round);
                }
            }
        }
        serializedObject.ApplyModifiedProperties();

        EditorUtility.SetDirty(target);
    }
    void createNewSplash(SplashImages myTarget)
    {
        BaseImage[] rz = myTarget.GetComponentsInChildren<BaseImage>(true);
        GameObject go = new GameObject();
        int count = rz.Length + 1;
        go.name = "Splash" + count;

        go.transform.parent = myTarget.transform;

        BaseImage newRound = go.AddComponent<BaseImage>();

        List<BaseImage> rounds = new List<BaseImage>();
        for(int i=0; i<myTarget.splashImages.Length; i++)
        {
            rounds.Add(myTarget.splashImages[i]);
        }
        rounds.Add(newRound);
        myTarget.splashImages = rounds.ToArray();

        myTarget.splashIndex = myTarget.splashImages.Length-1;

        serializedObject.ApplyModifiedProperties();
        EditorUtility.SetDirty(myTarget);
    }
    void handleRounds(SplashImages myTarget)
    {
        EditorGUILayout.LabelField("Splash Images");
        if(GUILayout.Button("New Splash"))
        {
            createNewSplash(myTarget);
        }
        if(GUILayout.Button("Delete current"))
        {
            deleteSplash(myTarget);
        }
        EditorGUILayout.IntSlider(serializedObject.FindProperty("splashIndex"),0,myTarget.splashImages.Length-1	);

        float fround = (float)myTarget.splashIndex;
        float nomRounds = (float)myTarget.splashImages.Length-1;
        float val = fround / nomRounds;

        ProgressBar (val, "Splash");

        if(myTarget.splashImages.Length>0 && 		myTarget.splashIndex>-1)
        {
            BaseImage round = myTarget.splashImages[myTarget.splashIndex];
            if(round)
            {
                if(round.fadeType==BaseImage.FadeType.FADE)
                {
                    handleFade (round);
                }
                if(round.fadeType==BaseImage.FadeType.SPLASH)
                {
                    handleSplash (round);
                }
            }
        }
        serializedObject.ApplyModifiedProperties();

        EditorUtility.SetDirty(target);
    }
Пример #8
0
        public void SplashService_GetImagesBySearch()
        {
            SplashImages splashImages = _splashBaseService.GetImagesBySearch("Laptop");

            Assert.NotEmpty(splashImages.images);
        }