コード例 #1
0
    void UpdateWaitingForResourcesLoaded()
    {
        float progress = 0;
        bool  complete = true;

        foreach (CustomResource resource in resourcesLoading)
        {
            progress += resource.www.progress;
            if (!resource.www.isDone)
            {
                complete = false;
            }
        }

        // Update progress bar
        if (resourcesLoading.Count > 0)
        {
            progress /= resourcesLoading.Count;
        }
        else
        {
            progress = 1;
        }

        progressText.text = "Loading custom resources... " + Mathf.Round(progress * 100).ToString() + "%";

        if (complete)
        {
            OnResourceLoadingComplete();
            currentState = UpdateWaitingForPackingCompelte;
        }
    }
コード例 #2
0
    public void StartFade()
    {
        Debug.Log("Save event");
        alpha += fadeSpeed * Time.deltaTime;

        currentUpdateState = UpdateFadeIn;
    }
コード例 #3
0
    public GameplayStateSystem(float playFromTime, bool botEnabled)
    {
        this.botEnabled   = botEnabled;
        this.playFromTime = playFromTime;

        currentUpdate = UpdateWaitingForNotesSettled;
    }
コード例 #4
0
 void UpdateWaitingForSaveEnd()
 {
     if (CheckSaveConcluded())
     {
         currentUpdateState = UpdateFadeOut;
     }
 }
コード例 #5
0
    public GameplayStateSystem(HitWindowFeeder hitWindowFeeder, bool botEnabled)
    {
        this.hitWindowFeeder = hitWindowFeeder;
        this.botEnabled      = botEnabled;

        currentUpdate = UpdateWaitingForNotesSettled;
    }
コード例 #6
0
    protected StateMachine(int _stateCount)
    {
        mCurrentState = mNextState = INVALID_STATE;

        mUpdateFn = new UpdateFn[_stateCount];
        mEnterFn  = new EnterFn[_stateCount];
        mExitFn   = new ExitFn[_stateCount];
    }
コード例 #7
0
    protected void SetStateFn(int _state, UpdateFn _update, EnterFn _enter = null, ExitFn _exit = null)
    {
        Debug.Assert(_state != INVALID_STATE);
        Debug.Assert(_state < mUpdateFn.Length);

        mUpdateFn[_state] = _update;
        mEnterFn[_state]  = _enter;
        mExitFn[_state]   = _exit;
    }
コード例 #8
0
 void Start()
 {
     feasibleStates = new List <string> ()
     {
         "on-hold", "on-play"
     };
     lastState     = feasibleStates [0];
     myEventScript = GetComponent <EventScript> ();
     myUpdateFn    = FindObjectOfType <UpdateFn> ();
 }
コード例 #9
0
    void UpdateWaitingForNotesSettled()
    {
        // We need to wait a couple of frames for the physics system to settle down, otherwise notes can be sprawled all over the place if we're being spammy about playing
        --hitWindowFrameDelayCount;

        if (hitWindowFrameDelayCount <= 0)
        {
            currentUpdate = UpdateGameplay;
        }
    }
コード例 #10
0
    // Use this for initialization
    void Start()
    {
        myUpdate = FindObjectOfType <UpdateFn> ();

        if (PlayerPrefs.HasKey("userID"))
        {
            userID = PlayerPrefs.GetString("userID");
            Debug.Log("UserID " + userID + " login succesfully");
        }
    }
コード例 #11
0
    // Use this for initialization
    void Start()
    {
        Application.runInBackground = true;
        assetPacker = GetComponent <AssetPacker>();

        currentState = UpdateWaitingForResourcesLoaded;

#if UNITY_EDITOR
        skinDirectory = Directory.GetParent(Application.dataPath) + "\\" + skinDirectory;
#else
        skinDirectory = DirectoryHelper.GetMainDirectory() + "\\" + skinDirectory;
#endif

        Debug.Log("Loading skin from directory " + skinDirectory);

        if (Directory.Exists(skinDirectory))
        {
            SetupResourcesToLoad();

            // Collect all the files
            string[] filepaths = GetAllFiles(skinDirectory).ToArray();
            Dictionary <string, string> filepathsDictionary = new Dictionary <string, string>();

            int bgCount = 0;

            foreach (string path in filepaths)
            {
                filepathsDictionary.Add(Path.GetFileNameWithoutExtension(path), path);

                // System.Text.RegularExpressions.Regex.Match(Path.GetFileNameWithoutExtension(path), @"background-/([0-9]+)$");
                //if ( Path.GetFileNameWithoutExtension(path).Contains("background-\d+"))
                if (System.Text.RegularExpressions.Regex.Match(Path.GetFileNameWithoutExtension(path), @"background-[0-9]+").Success)
                {
                    resources.Add(new CustomTexture(Path.GetFileNameWithoutExtension(path), 1920, 1080));
                    ++bgCount;
                }
            }

            Debug.Log("Total backgrounds: " + bgCount);

            foreach (CustomResource resource in resources)
            {
                if (resource.InitWWW(filepathsDictionary))
                {
                    resourcesLoading.Add(resource);
                    resourcesDictionary.Add(resource.name, resource);
                }
            }
        }
        else
        {
            Debug.LogError("Custom Resources not found");
        }
    }
コード例 #12
0
    void UpdateFadeOut()
    {
        alpha         -= fadeSpeed * Time.deltaTime;
        alpha          = Mathf.Clamp01(alpha);
        saveText.color = new Color(saveText.color.r, saveText.color.g, saveText.color.b, alpha);

        if (alpha <= 0)
        {
            currentUpdateState = null;
        }
    }
コード例 #13
0
    public IndicatorPressedInputSystem(HitAnimation[] animations, Chart.GameMode gameMode)
    {
        this.animations = animations;

        switch (gameMode)
        {
        case Chart.GameMode.Drums:
        {
            updateFn = UpdateDrumPadPresses;
            break;
        }

        default:
        {
            updateFn = UpdateGuitarFretPresses;
            break;
        }
        }
    }
コード例 #14
0
    void UpdateFadeIn()
    {
        if (CheckSaveConcluded())
        {
            // Don't bother displaying the save anim for super short saves
            currentUpdateState = UpdateFadeOut;
        }
        else
        {
            alpha         += fadeSpeed * Time.deltaTime;
            alpha          = Mathf.Clamp01(alpha);
            saveText.color = new Color(saveText.color.r, saveText.color.g, saveText.color.b, alpha);

            if (alpha >= 1.0f)
            {
                currentUpdateState = UpdateWaitingForSaveEnd;
            }
        }
    }
コード例 #15
0
    // Use this for initialization
    void Start()
    {
        Application.runInBackground = true;
        assetPacker = GetComponent <AssetPacker>();

        currentState = UpdateWaitingForResourcesLoaded;

#if UNITY_EDITOR
        skinDirectory = Directory.GetParent(Application.dataPath) + "\\" + skinDirectory;
#else
        skinDirectory = DirectoryHelper.GetMainDirectory() + "\\" + skinDirectory;
#endif

        Debug.Log("Loading skin from directory " + skinDirectory);

        if (Directory.Exists(skinDirectory))
        {
            SetupResourcesToLoad();

            // Collect all the files
            string[] filepaths = GetAllFiles(skinDirectory).ToArray();
            Dictionary <string, string> filepathsDictionary = new Dictionary <string, string>();

            int bgCount = 0;

            foreach (string path in filepaths)
            {
                string assetKey = Path.GetFileNameWithoutExtension(path);
                if (!filepathsDictionary.ContainsKey(assetKey))
                {
                    filepathsDictionary.Add(assetKey, path);
                }
                else
                {
                    Debug.LogWarning("Found a duplicate custom asset with under a different file extenstion. Ignoring asset " + path);
                    continue;
                }

                // Checking if the file provided is a background. We have no limit on the amount of backgrounds we can load, so we can't pre-define them like we do above.
                if (System.Text.RegularExpressions.Regex.Match(assetKey, @"background-[0-9]+").Success)
                {
                    resources.Add(new CustomTexture(assetKey, 1920, 1080));
                    ++bgCount;
                }
            }

            Debug.Log("Total backgrounds: " + bgCount);

            foreach (CustomResource resource in resources)
            {
                if (resource.InitWWW(filepathsDictionary))
                {
                    resourcesLoading.Add(resource);
                    resourcesDictionary.Add(resource.name, resource);
                }
            }
        }
        else
        {
            Debug.LogError("Custom Resources not found");
        }
    }