private void DoChoice(RandomEvent.Choice choice)
        {
            int actionValueSkill = 0;
            int actionValueFollowers = 0;
            foreach (RandomEvent.ChoiceAction action in choice.Actions)
            {
                switch (action.Action)
                {
                    case RandomEvent.ChoiceAction.ActionType.SkillIncrease:
                        {
                            int increaseValue = (int)action.Values[1];
                            if (action.Values.Length > 3)
                                switch ((PlayerSkill)action.Values[2])
                                {
                                    case PlayerSkill.Knowledge:
                                        increaseValue += Player.Instance.KnowledgeSkills * (int)action.Values[3];
                                        break;
                                    case PlayerSkill.Presentation:
                                        increaseValue += Player.Instance.PresentationSkills * (int)action.Values[3];
                                        break;
                                    case PlayerSkill.Media:
                                        increaseValue += Player.Instance.MediaSkills * (int)action.Values[3];
                                        break;
                                    default:
                                        throw new ArgumentOutOfRangeException();
                                }
                            if (increaseValue < 0)
                            {
                                this.VisualFeedBack(increaseValue.ToString()).GetComponent<Animator>().SetTrigger("SkillUp");
                            }
                            else
                            {
                                this.VisualFeedBack("+ " + increaseValue.ToString()).GetComponent<Animator>().SetTrigger("SkillUp");
                            }

                            actionValueSkill += increaseValue;
                            IncreasePlayerSkill((PlayerSkill)action.Values[0], increaseValue);
                            break;
                        }
                    case RandomEvent.ChoiceAction.ActionType.FollowerIncrease:
                        {
                            int increaseValue = (int)action.Values[0];
                            if (action.Values.Length > 2)
                                switch ((PlayerSkill)action.Values[1])
                                {
                                    case PlayerSkill.Knowledge:
                                        increaseValue += Player.Instance.KnowledgeSkills * (int)action.Values[2];
                                        break;
                                    case PlayerSkill.Presentation:
                                        increaseValue += Player.Instance.PresentationSkills * (int)action.Values[2];
                                        break;
                                    case PlayerSkill.Media:
                                        increaseValue += Player.Instance.MediaSkills * (int)action.Values[2];
                                        break;
                                    default:
                                        throw new ArgumentOutOfRangeException();
                                }

                            this.VisualFeedBack("+ " + increaseValue.ToString()).GetComponent<Animator>().SetTrigger("FollowerUp");
                            actionValueFollowers += increaseValue;
                            FollowerManager.Instance.TotalFollowers += increaseValue;
                            break;
                        }
                    case RandomEvent.ChoiceAction.ActionType.Ok:
                        {
                            break;
                        }
                    case RandomEvent.ChoiceAction.ActionType.NewLightbulbNear:
                        {
                            bool respawn = (bool)action.Values[0];
                            BalloonManager.Instance.SpawnLightbulb(respawn);
                            break;
                        }
                    case RandomEvent.ChoiceAction.ActionType.VisitUrl:
                        {

            #if (UNITY_IPHONE || UNITY_ANDROID)
                            YoutubeVideo ytv = new YoutubeVideo();
                            UnityEngine.Handheld.PlayFullScreenMovie(ytv.RequestVideo(this.CurrentRandomEvent.TedUrl, 720));
            #else
                            Application.OpenURL(this.CurrentRandomEvent.TedUrl);
            #endif
                            Player.Instance.KnowledgeSkills++;
                            break;
                        }
                    case RandomEvent.ChoiceAction.ActionType.Tutorial:
                        {
                            this._notificationPanel.SetActive(false);
                            this._temporaryTutorialCanvas.SetActive(true);
                            break;
                        }
                    default:
                        {
                            throw new ArgumentOutOfRangeException();
                        }
                }
            }
            if (actionValueFollowers < 0 && actionValueSkill < 0)
            {
                AudioManager.Instance.PlayNegativeFeedback();
            }
            else if (actionValueFollowers > 0 && actionValueSkill > 0)
            {
                AudioManager.Instance.PlayPositiveFeedback();
            }

            this.HideRandomEventsCanvas();
            this.NewRandomEvent(choice);
            this.UpdateToGuiTopcurrentRandomEvent();
        }
Exemple #2
0
    void OnGUI()
    {
        GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), kronuzBg);

        GUI.Label(new Rect(0, 40, 40, 20), "Search:");
        searchString = GUI.TextField(new Rect(50, 40, 100, 20), searchString, 25);
        GUI.Label(new Rect(150, 40, 60, 20), "Category:");
        category = GUI.TextField(new Rect(200, 40, 100, 20), category, 25);



        if (GUI.Button(new Rect(0, 190, 100, 60), "Filter Category:\n" + useCategoryFilter.ToString()))
        {
            if (useCategoryFilter)
            {
                useCategoryFilter = false;
            }
            else
            {
                useCategoryFilter = true;
            }
        }

        if (GUI.Button(new Rect(0, 70, 100, 100), "Search Video"))
        {
            YoutubeV3Call("video");
            //SearchNow();
        }
        if (GUI.Button(new Rect(0, 270, 100, 60), "Filter By Date:\n" + filterByDate.ToString()))
        {
            if (filterByDate)
            {
                filterByDate = false;
            }
            else
            {
                filterByDate = true;
            }
        }


        if (generated)
        {
            int y = 70;
            for (int x = 0; x < videos.Count; x++)
            {
                GUI.DrawTexture(new Rect(100, y, 100, 100), thumbs [x]);
                if (GUI.Button(new Rect(100, y, 100, 100), ""))
                {
                    //the Handheld.PlayFullScreenMovie play the video using native unity and the first parameter are the video url
                    Debug.Log("Started Video - Only run on mobile");
                    StartCoroutine(PlayVideo(youtube.RequestVideo(videos[x].id, 360)));                    //360 is the desired video quality
                }
                GUI.Label(new Rect(210, y + 2, 200, 20), videos [x].title);
                GUI.Label(new Rect(210, y + 22, 200, 20), "Duration: " + videos [x].duration);
                GUI.Label(new Rect(210, y + 42, 200, 20), "Views: " + videos [x].views + " Likes: " + videos [x].likes + "");
                GUI.Label(new Rect(210, y + 62, 200, 20), "Dislikes: " + videos [x].dislikes + " Fav: " + videos [x].favorites);
                GUI.Label(new Rect(210, y + 82, 200, 20), "Comments: " + videos [x].comments);



                y = y + 100;
            }
        }

        GUI.Label(new Rect((Screen.width / 2), (Screen.height / 2), 100, 30), loadintStr);
    }
Exemple #3
0
    public Texture2D kronuzBg; //remove..

    void OnGUI()
    {
        GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), kronuzBg);

        GUI.Label(new Rect(0, 40, 40, 20), "Search:");
        searchString = GUI.TextField(new Rect(50, 40, 100, 20), searchString, 25);
        GUI.Label(new Rect(150, 40, 60, 20), "Category:");
        category = GUI.TextField(new Rect(200, 40, 100, 20), category, 25);



        if (GUI.Button(new Rect(0, 190, 100, 60), "Filter Category:\n" + useCategoryFilter.ToString()))
        {
            if (useCategoryFilter)
            {
                useCategoryFilter = false;
            }
            else
            {
                useCategoryFilter = true;
            }
        }

        if (GUI.Button(new Rect(0, 70, 100, 100), "Search Channel"))
        {
            YoutubeV3Call("video");
        }
        if (GUI.Button(new Rect(0, 270, 100, 60), "Filter By Date:\n" + filterByDate.ToString()))
        {
            if (filterByDate)
            {
                filterByDate = false;
            }
            else
            {
                filterByDate = true;
            }
        }


        if (generatedChannels)
        {
            int y = 70;
            for (int x = 0; x < videos.Count; x++)
            {
                GUI.DrawTexture(new Rect(100, y, 100, 100), thumbs[x]);
                if (GUI.Button(new Rect(100, y, 100, 100), ""))
                {
                    LoadChannelV3Videos(videos[x].id);
                    Debug.Log("Loading channel videos");
                }
                GUI.Label(new Rect(210, y + 2, 200, 20), videos[x].title);
                GUI.Label(new Rect(210, y + 22, 200, 40), "Click on thumbnail to \n open channel videos");

                y = y + 100;
            }
        }

        if (generated)
        {
            int y = 70;
            for (int x = 0; x < videoList.Count; x++)
            {
                GUI.DrawTexture(new Rect(100, y, 100, 100), thumbs[x]);
                if (GUI.Button(new Rect(100, y, 100, 100), ""))
                {
                    Debug.Log("Started Video - Only run on mobile");
                    StartCoroutine(PlayVideo(youtube.RequestVideo(videoList[x].id, 360))); //360 is the desired video Quallity
                }

                GUI.Label(new Rect(210, y + 2, 200, 20), videoList[x].title);
                GUI.Label(new Rect(210, y + 22, 200, 20), "Duration: " + videoList[x].duration);
                GUI.Label(new Rect(210, y + 42, 200, 20), "Views: " + videoList[x].views + " Likes: " + videoList[x].likes + "");
                GUI.Label(new Rect(210, y + 62, 200, 20), "Dislikes: " + videoList[x].dislikes + " Fav: " + videoList[x].favorites);
                GUI.Label(new Rect(210, y + 82, 200, 20), "Comments: " + videoList[x].comments);



                y = y + 100;
            }
        }

        GUI.Label(new Rect((Screen.width / 2), (Screen.height / 2), 100, 30), loadintStr);
    }