Inheritance: MonoBehaviour
        public async Task AddNewStreamVideoAsync(string url)
        {
            if (string.IsNullOrEmpty(url))
            {
                throw new ArgumentNullException("Invalid URL input");
            }


            if (url.Contains(WOSHUGAMING_ID) || url.Contains(WOSHUGAMING_TXT))
            {
                if (context.StreamVideos.Any(p => p.URL.Equals(url)))
                {
                    throw new ArgumentException($"'{url}' already exist.");
                }

                var newEntity = new StreamVideo
                {
                    URL = url.Contains(WOSHUGAMING_ID) ? url.Replace(WOSHUGAMING_ID, WOSHUGAMING_TXT) : url
                };
                await context.StreamVideos.AddAsync(newEntity);

                await context.SaveChangesAsync();
            }
            else
            {
                throw new ArgumentException($"'{url}' is not a Woshu stream video.");
            }
        }
Exemple #2
0
    public void PlayVideo()
    {
        m_canvas.SetActive(true);
        StreamVideo stream = m_canvas.GetComponent <StreamVideo>();

        stream.SetAdress(m_videoAdress);
        stream.PlayVideo();
    }
Exemple #3
0
    public void Begin(StreamVideo streamVideoScript)
    {
        audioSource            = GetComponent <AudioSource>();
        this.streamVideoScript = streamVideoScript;

        gameObject.SetActive(false);
        controller = GameObject.FindGameObjectWithTag("Player").GetComponent <CharacterController>();
    }
    private void Start()
    {
        streamVideoScript = GetComponent <StreamVideo>();
        subtitleScript    = Instantiate(subtitlesPrefab).GetComponent <SubtitleScript>();

        streamVideoScript.Begin(subtitleScript.background);
        subtitleScript.Begin(streamVideoScript);
    }
Exemple #5
0
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
     }
 }
Exemple #6
0
 private void Awake()
 {
     if (_instance == null)
     {
         _instance = this;
     }
     else
     {
         Debug.LogError("AN INSTANCE ALREADY EXISTS");
     }
 }
Exemple #7
0
        public override void Enter()
        {
            levelManager = FindObjectOfType <LevelManager>();
            ui           = context.gameManager.GetUIManager();

            videoStream = levelManager.GetVideoStream();
            if (videoStream != null)
            {
                videoStream.OnVideoEnd += SetupStartGame;
                videoStream.PlayVideo();
            }
            else
            {
                SetupStartGame();
            }
        }
        private void OnSceneLoaded(Scene _scene, LoadSceneMode _mode)
        {
            uiManager = context.gameManager.FindUIManager();
            LevelManager levelManager = FindObjectOfType <LevelManager>();

            levelManager.Init(uiManager, context.gameManager.GetLevelsManager().GetMode());
            videoStream = levelManager.GetVideoStream();
            if (videoStream != null)
            {
                videoStream.OnVideoLoad += HandleVideoLoaded;
                videoStream.LoadVideo();
            }
            else
            {
                uiManager.ToggleMenu(MenuType.None);
                context.OnLevelSetupCallback();
            }
        }
Exemple #9
0
    public void LoadVideoInsidePicture()
    {
        NativeGallery.Permission permission = NativeGallery.GetVideoFromGallery((path) =>
        {
            Debug.Log("Video path: " + path);
            if (path != null)
            {
                foreach (GameObject element in GameObject.FindGameObjectsWithTag("TakePictureBtn"))
                {
                    element.SetActive(false);
                }

                NativeGallery.VideoProperties videoProperties = NativeGallery.GetVideoProperties(path);
                GameObject pictureVideo  = Instantiate(Resources.Load <GameObject>("Prefabs/Picture/PictureVideo"));
                StreamVideo streamScript = pictureVideo.GetComponent <StreamVideo>();
                pictureVideo.GetComponent <PictureController>().SetMediaPath(path);

                if (videoProperties.rotation == 180 || videoProperties.rotation == 0)
                {
                    streamScript.SetRotationVideo(videoProperties.rotation);
                }
                else
                {
                    streamScript.SetRotationVideo(videoProperties.rotation - 180);
                }
                streamScript.SetPath(path);
                streamScript.LoadVideoInsidePicture();

                EnableButtonPhoto();

                confirmSavePhotoBtn.GetComponent <SavePhotoController>().setPicture(pictureVideo);
                confirmCancelPhotoBtn.GetComponent <SavePhotoController>().setPicture(pictureVideo);
            }
        }, "Select a video");
        Debug.Log("Permission result: " + permission);
    }
Exemple #10
0
    /// <summary>
    /// Inizializzazione elementi del livello (verrà chiamata dalla SM)
    /// </summary>
    public void Init(UI_ManagerBase _uiManager, bool _speedrunMode)
    {
        instance  = this;
        pause     = false;
        uiManager = _uiManager.GetGameplayManager();

        //Init
        poolMng = GetComponent <PoolManager>();
        if (poolMng != null)
        {
            poolMng.Init();
        }

        stickyMng = GetComponent <StickyObjectManager>();
        if (stickyMng != null)
        {
            stickyMng.Init();
        }

        enemyMng = GetComponent <EnemyManager>();
        if (enemyMng != null)
        {
            enemyMng.Init();
        }

        platformMng = GetComponent <PlatformManager>();
        if (platformMng != null)
        {
            platformMng.Init(uiManager.GetGameplayManager());
        }

        speedMng = GetComponent <SpeedrunManager>();
        if (speedMng != null)
        {
            speedMng.Init(_speedrunMode);
        }

        checkpointMng = GetComponent <CheckpointManager>();
        if (checkpointMng != null)
        {
            checkpointMng.Init(speedMng);
        }

        poopCtrl = FindObjectOfType <PoopController>();
        if (poopCtrl != null)
        {
            poopCtrl.Init();
        }

        tokenMng = GetComponent <TokenManager>();
        if (tokenMng != null)
        {
            tokenMng.Init(speedMng);
        }

        player = FindObjectOfType <Player>();
        if (player != null)
        {
            player.Init(enemyMng, platformMng, tokenMng);
        }

        tutorialMng = GetComponent <TutorialManager>();
        if (tutorialMng != null)
        {
            tutorialMng.Init(enemyMng, player);
        }

        cameraMng = GetComponent <CameraManager>();
        if (cameraMng != null)
        {
            cameraMng.Init();
        }

        doorsMng = GetComponent <DoorsButtonsManager>();
        if (doorsMng != null)
        {
            doorsMng.Init();
        }

        videoStream = FindObjectOfType <StreamVideo>();

        //Setup
        enemyMng.EnemiesSetup();

        //Iscrizione Eventi
        PlayerInputManager.OnPausePressed += HandlePlayerPauseButtonPressed;
        player.OnPlayerDeath += HandlePlayerDeath;
        OnGamePause          += GamePause;
        OnGameUnPause        += GameUnPause;
    }
Exemple #11
0
 private void Awake()
 {
     singleton = this;
 }