Exemplo n.º 1
0
    void OnMomentumChangedHandler(MomentumData momentumData)
    {
        // Both the following visually represent gaining/losing an entire point.
        while (momentumData.TotalMomentumPoints > currentTotalMomentumPoints)
        {
            percentageProgressToNextMomentum = 0;
            currentTotalMomentumPoints++;

            momentumBarTransitionsQueue.EnqueueAction(FillAndResetBar());
        }
        while (momentumData.TotalMomentumPoints < currentTotalMomentumPoints)
        {
            percentageProgressToNextMomentum = 0;
            currentTotalMomentumPoints--;

            momentumBarTransitionsQueue.EnqueueAction(EmptyAndResetBar());
        }

        float updatedPercentageProgress = (float)momentumData.ProgressTowardNextMomentum / (float)momentumData.MomentumRequiredForNextPoint;

        if (updatedPercentageProgress != percentageProgressToNextMomentum)
        {
            percentageProgressToNextMomentum = updatedPercentageProgress;

            momentumBarTransitionsQueue.EnqueueAction(UpdateMomentumBarProgress());
        }
    }
Exemplo n.º 2
0
    public void SetImage(Texture2D texture, string imageIdentifier, int textureIndex, bool animateOnSet)
    {
        m_imageSphereController.SetTextureInUse(m_nextTextureIndex, false); // Textures that were going to be used can be thrown away
        m_imageSphereController.SetTextureInUse(textureIndex, true);
        m_nextTextureIndex = textureIndex;

        m_imageIdentifier    = imageIdentifier;
        m_imageSphereTexture = texture;

        if (Debug.isDebugBuild)
        {
            Debug.Log("------- VREEL: Finished Loading Image from Texture2D, " +
                      " AnimateOnSet = " + animateOnSet +
                      " , ImageIdentifier = " + imageIdentifier +
                      " , PluginTextureIndex = " + textureIndex +
                      " , Texture size = " + m_imageSphereTexture.width + " x " + m_imageSphereTexture.height);
        }

        m_coroutineQueue.Clear();
        if (!animateOnSet)
        {
            UpdateTextureAndID();
        }
        else
        {
            m_coroutineQueue.EnqueueAction(AnimateSetTexture());
        }
    }
Exemplo n.º 3
0
    /*
     * public void NextPosts()
     * {
     *  if (Debug.isDebugBuild) Debug.Log("------- VREEL: NextPosts() called");
     *
     *  int numImagesToLoad = m_imageSphereController.GetNumSpheres();
     *  int numPosts = m_posts.Count;
     *
     *  m_currPostIndex = Mathf.Clamp(m_currPostIndex + numImagesToLoad, 0, numPosts);
     *
     *  m_imageLoader.InvalidateLoading(); // Stop anything we may have already been loading
     *  m_coroutineQueue.Clear(); // Ensures we don't repeat operations
     *
     *  if (m_nextPageOfPosts != null)
     *  { // By calling this every time a user presses the next button, we ensure he can never miss out on posts and don't overload the API
     *      m_coroutineQueue.EnqueueAction(StorePostsFromNextPage());
     *  }
     *
     *  m_coroutineQueue.EnqueueAction(RefreshPostsAtCurrIndex());
     *  m_coroutineQueue.EnqueueAction(DownloadThumbnailsAndSetSpheres());
     * }
     */

    public void NextPost(int imageSphereIndex)
    {
        if (Debug.isDebugBuild)
        {
            Debug.Log("------- VREEL: NextPost() called with index: " + imageSphereIndex);
        }

        int numImagesToLoad = 1;
        int numSpheres      = m_imageSphereController.GetNumSpheres();
        int numPosts        = m_posts.Count;

        m_currPostIndex = Mathf.Clamp(m_currPostIndex + numImagesToLoad, 0, numPosts);

        //m_imageLoader.InvalidateLoading(); // Stop anything we may have already been loading
        //m_coroutineQueue.Clear(); // Ensures we don't repeat operations

        if (m_nextPageOfPosts != null)
        { // By calling this every time a user presses the next button, we ensure he can never miss out on posts and don't overload the API
            m_coroutineQueue.EnqueueAction(StorePostsFromNextPage());
        }

        if (Debug.isDebugBuild)
        {
            Debug.Log("------- VREEL: CurrPostIndex: " + m_currPostIndex);
        }

        int postIndex = m_currPostIndex + (numSpheres - 1);

        m_coroutineQueue.EnqueueAction(RefreshPostsAtIndex(postIndex));
        m_coroutineQueue.EnqueueAction(DownloadThumbnailAndSetSphere(imageSphereIndex, postIndex));
    }
Exemplo n.º 4
0
 internal void PlayCard()
 {
     foreach (CardEffect effect in card.Effects)
     {
         animQueue.EnqueueAction(effect.EffectAnimation(this));
         effect.ApplyEffect(this);
     }
     AfterPlay();
 }
Exemplo n.º 5
0
    public void DisplayLikeResults(string postId)
    {
        if (Debug.isDebugBuild)
        {
            Debug.Log("------- VREEL: DisplayLikeResults() called for post ID: " + postId);
        }

        m_resultType = ResultType.kLikes;
        m_title.GetComponentInChildren <Text>().text = "Likes";
        m_coroutineQueue.EnqueueAction(StoreAndDisplayUserResultsInternal(postId));
    }
Exemplo n.º 6
0
 public void SetMenuBarProfileDetails()
 {
     if (m_user.IsLoggedIn())
     {
         m_menuBarProfileButtonObject.GetComponentInChildren <Text>().text = m_user.m_handle;
         m_coroutineQueue.EnqueueAction(SetMenuBarProfileDetailsInternal());
     }
     else
     {
         m_menuBarProfileButtonObject.GetComponentInChildren <Text>().text = "Guest";
         m_imageSphereController.HideSphereAtIndex(Helper.kMenuBarProfileSphereIndex);
     }
 }
Exemplo n.º 7
0
    internal void DrawCard()
    {
        if (gameState.PlayerDeck.Count < 1)
        {
            Refill();
            Shuffle();
        }
        var cardToDraw = gameState.PlayerDeck[gameState.PlayerDeck.Count - 1];

        gameState.PlayerDeck.Remove(cardToDraw);
        cardToDraw.transform.SetParent(CardGame.CardGameRef.transform);
        CardGame.PlayerHand.AddCard(cardToDraw);
        animQueue.EnqueueAction(CardLeavesHand());
    }
Exemplo n.º 8
0
    public void DisplayCommentResults(string postId, ImageSphere imageSphere)
    {
        if (Debug.isDebugBuild)
        {
            Debug.Log("------- VREEL: DisplayCommentResults() called for post ID: " + postId);
        }

        m_currImageSphere = imageSphere;
        string commentCountText = m_currImageSphere.GetCommentCount().ToString() + (m_currImageSphere.GetCommentCount() == 1 ? " comment" : " comments");

        m_commentCountInList.GetComponentInChildren <Text>().text    = commentCountText;
        m_commentCountInSummary.GetComponentInChildren <Text>().text = commentCountText;
        m_coroutineQueue.EnqueueAction(StoreAndDisplayCommentResultsInternal(postId));
    }
Exemplo n.º 9
0
    // Update is called once per frame
    void Update()
    {
        if (finished)
        {
            return;
        }
        secondSinceLastTip   += Time.deltaTime;
        rotationSinceLastTip += Input.gyro.rotationRateUnbiased.y;
        if (check())
        {
            if (tips.Count > 0)
            {
                lastTip    = currentTip;
                currentTip = tips.Pop();
                Debug.Log("Acceleration: current tip " + currentTip);
                rotationSinceLastTip = 0.0f;
                secondSinceLastTip   = 0.0f;
                if (lastTip == currentTip)
                {
                    queue.EnqueueAction(TypeText("Sorry, I need you to " + tipString [(int)currentTip] + " again"));
                }
                else
                {
                    queue.EnqueueAction(TypeText("Sorry, I need you to " + tipString [(int)currentTip]));
                }
                queue.EnqueueWait(sentencePause);
            }
            else
            {
                queue.EnqueueAction(TypeText("you got it! Watch " + spot.GetName()));
                queue.EnqueueWait(sentencePause);
                queue.EnqueueAction(playVideo());
                finished = true;
            }
        }
        else
        {
            if (secondSinceLastTip > 20.0f)
            {
                queue.EnqueueAction(TypeText("I'm still waiting for looking " + tipAgainString [(int)currentTip]));
                queue.EnqueueWait(sentencePause);
                secondSinceLastTip = 0.0f;
                Debug.Log("Acceleration: rotation " + rotationSinceLastTip);
            }
        }
//		textComp.text = "x: " + Input.acceleration.x + "\ny: " + Input.acceleration.y + "\nz: " + Input.acceleration.z;
//		rotationSinceLastTip += Input.gyro.rotationRateUnbiased.y;
//		textComp.text = "" + rotationSinceLastTip;
    }
 //Change material by adding it to coroutine queue
 void UpdateColourAtlas(ObjectData objectData)
 {
     for (int i = 0; i < objectData.PrefabArray.Length; i++)
     {
         miscQueue.EnqueueAction(objectGenerator.ChangeColourAtlas(objectData.ObjectMaterial, objectData.PrimaryColour, objectData.SecondaryColour, objectData.TertiaryColour, objectData.QuaternaryColour));
     }
 }
Exemplo n.º 11
0
 internal void AddCard(CardGameobject card)
 {
     gameState.PlayerDiscard.Add(card);
     card.Interactable(false);
     animQueue.EnqueueAction(MoveCardToDiscardAnimation(card));
     animQueue.EnqueueWait(0.1f);
 }
Exemplo n.º 12
0
    // Use this for initialization
    void Start()
    {
        Input.gyro.enabled = true;
        finished           = false;
        spot = GlobalConstants.locations [GlobalConstants.SPOT_NAME];

        textComp = GetComponent <Text>();
        // use "this" monobehaviour as the coroutine owner
        queue = new CoroutineQueue(this);
        queue.StartLoop();

        System.Random rnd = new System.Random(System.DateTime.Now.Millisecond);
        tipTimes = rnd.Next(1, 4);         // 1 2 3

        tips = new Stack <Orientation> ();

        for (int i = 0; i < tipTimes; ++i)
        {
            tips.Push((Orientation)rnd.Next(0, 4));
        }
        lastTip              = Orientation.None;
        currentTip           = tips.Pop();
        rotationSinceLastTip = 0.0f;
        secondSinceLastTip   = 0.0f;
        Debug.Log("Acceleration: current tip " + currentTip);
        queue.EnqueueAction(TypeText(tipString [(int)currentTip]));
        queue.EnqueueWait(sentencePause);
    }
    public void GenerateHouses(ChunkData chunkData)
    {
        IEnumerator gen = objectGenerator.GenerateObjects(ObjectType.House, ProceduralTerrain.Current.TerrainHouseData, chunkData);

        mainQueue.EnqueueAction(gen);
        mainQueue.EnqueueAction(GenerateVillages(chunkData));
        mainQueue.EnqueueAction(GenerateTreeHouseHouses(chunkData));
    }
Exemplo n.º 14
0
    private void Awake()
    {
        momentumBarTransitionsQueue = new CoroutineQueue(this);

        maximumMomentumBarWidth          = momentumBar.rectTransform.sizeDelta.x;
        momentumBarHeight                = momentumBar.rectTransform.sizeDelta.y;
        percentageProgressToNextMomentum = (float)MomentumManager.CurrentMomentumData.ProgressTowardNextMomentum / (float)MomentumManager.CurrentMomentumData.MomentumRequiredForNextPoint;
        currentTotalMomentumPoints       = MomentumManager.CurrentMomentumData.TotalMomentumPoints;

        momentumBarTransitionsQueue.EnqueueAction(UpdateMomentumBarProgress());
    }
Exemplo n.º 15
0
 public void Update()
 {
     if (m_searchState != SearchState.kNone)
     {
         Text searchTextComponent = m_searchInput.GetComponentInChildren <Text>();
         m_workingString = Regex.Replace(searchTextComponent.text, @"\s+[|]", String.Empty);
         bool stringChanged = !String.Equals(m_currSearchString, m_workingString, StringComparison.OrdinalIgnoreCase);
         if (stringChanged)
         {
             m_currSearchString = searchTextComponent.text;
             if (m_currSearchString.Length > 0)
             {
                 if (m_searchState == SearchState.kUserSearch)
                 {
                     m_coroutineQueue.EnqueueAction(UpdateUserSearch());
                 }
                 else if (m_searchState == SearchState.kTagSearch)
                 {
                     m_coroutineQueue.EnqueueAction(UpdateTagSearch());
                 }
             }
         }
     }
 }
Exemplo n.º 16
0
    // Update is called once per frame
    void Update()
    {
        if (mState == LocationState.Enabled)
        {
            mLatitude  = Input.location.lastData.latitude;
            mLongitude = Input.location.lastData.longitude;

            float tempDistance = Haversine();
            if (tempDistance * KM_2_FOOT <= 100.0f)
            {
                queue.EnqueueAction(TypeText("congratulations! you made it!!!"));
                queue.EnqueueWait(sentencePause);
                queue.EnqueueAction(ChangeScene("GeoCamera"));                   // this need to change scene
                Input.location.Stop();
                mState = LocationState.Stopped;
            }
            else if (tempDistance < mDistance * 0.5f)
            {
                mDistance = tempDistance;
                queue.EnqueueAction(TypeText("you are getting closer now"));
                queue.EnqueueWait(sentencePause);
            }
        }
    }
Exemplo n.º 17
0
    // **************************
    // Public functions
    // **************************

    public void Start()
    {
        // Version dependent code
        m_vreelAnalyticsFile = GetSaveFile();
        m_analyticsFilePath  = Application.persistentDataPath + m_vreelAnalyticsFile;

        m_analyticsData       = new AnalyticsData();
        m_analyticsData.m_uid = "";

        m_threadJob = new ThreadJob(this);

        m_coroutineQueue = new CoroutineQueue(this);
        m_coroutineQueue.StartLoop();

        m_coroutineQueue.EnqueueAction(IdentifyInternal());
    }
Exemplo n.º 18
0
    public void EndTurn()
    {
        col.enabled = false;
        isEnabled   = false;
        foreach (TMP_Text text in texts)
        {
            text.outlineWidth = 0f;
        }

        StartCoroutine(EndTurnAnimation());

        CardGame.PlayerHand.DiscardHand();

        CardGame.PlayerDeckManager.DrawCard(5);

        animQueue.EnqueueAction(EnableEndTurnButton());
    }
Exemplo n.º 19
0
    // **************************
    // Public functions
    // **************************

    public void Start()
    {
        UnityEngine.Random.InitState((int)System.DateTime.Now.Ticks);

        // Version dependent code
        m_vreelSaveFile = GetSaveFile();
        m_dataFilePath  = Application.persistentDataPath + m_vreelSaveFile;

        m_loginData          = new LoginData();
        m_loginData.m_client = m_loginData.m_uid = m_loginData.m_accessToken = "";
        m_id = m_handle = m_email = m_name = m_profileDescription = "";

        m_backEndAPI = new BackEndAPI(this, m_errorMessage, this);

        m_coroutineQueue = new CoroutineQueue(this);
        m_coroutineQueue.StartLoop();

        m_threadJob = new ThreadJob(this);

        m_loadingLoginData = true;
        m_coroutineQueue.EnqueueAction(LoadLoginData());
    }
Exemplo n.º 20
0
    private void Start()
    {
        _queue = new CoroutineQueue(this);
        _queue.StartLoop();

        _queue.EnqueueAction(ShowStatusMessage("Press space to roll the dice"));

        _cameraController = GameObject.Find("CameraController").GetComponent <CameraController>();
        _buyProperty      = GameObject.Find("BuyUI").GetComponent <BuyProperty>();

        socketIo.PlayerJoined                  += SocketIoOnPlayerJoined;
        socketIo.PlayerLeft                    += SocketIoOnPlayerLeft;
        socketIo.PlayerRolledDice              += SocketIoOnPlayerRolledDice;
        socketIo.PlayerMoved                   += SocketIoOnPlayerMoved;
        socketIo.PlayerTurnChanged             += SocketIoOnPlayerTurnChanged;
        socketIo.PlayerPlaysAgain              += SocketIoOnPlayerPlaysAgain;
        socketIo.PlayerBalanceChanged          += SocketIoOnPlayerBalanceChanged;
        socketIo.PlayerSteppedOnChance         += SocketIoOnPlayerSteppedOnChance;
        socketIo.PlayerSteppedOnCommunityChest += SocketIoOnPlayerSteppedOnCommunityChest;
        socketIo.PropertyOwnerChanged          += SocketIoOnPropertyOwnerChanged;

        UpdateOwnedProperties();
        UpdateBottomBar();
        SetupPlayers();

        foreach (Transform child in players.transform)
        {
            if (child != players.transform)
            {
                playerList.Add(child.gameObject);
            }
        }

        var player = Player.GetPlayerById(GameManager.Instance.Game.CurrentPlayerId);

        UpdateBottomBarPlayerPlaying(player);

        _cameraController.SetUpCameras();
    }
Exemplo n.º 21
0
 public void LoginSelected()
 {
     m_coroutineQueue.Clear();
     m_coroutineQueue.EnqueueAction(LoginSelectedInternal());
 }
Exemplo n.º 22
0
 public void OpenAndroidGallery()
 {
     m_coroutineQueue.EnqueueAction(OpenAndroidGalleryInternal());
 }
Exemplo n.º 23
0
 internal void ChangePlayerHealth(int v)
 {
     gameState.PlayerHealth = gameState.PlayerHealth + v;
     animQueue.EnqueueAction(Health(v));
 }
Exemplo n.º 24
0
 public void ForceEnqueueScrollAction(string primaryTextContents, string secondaryTextContents)
 {
     scrollCoroutineQueue.EnqueueAction(ScrollText(primaryTextContents, secondaryTextContents));
 }
Exemplo n.º 25
0
 public void SetAllImageSpheresToLoading()
 {
     m_coroutineQueue.EnqueueAction(SetAllImageSpheresToLoadingInternal());
 }
Exemplo n.º 26
0
 public void SetClient(string client)
 {
     m_loginData.m_client = client;
     m_coroutineQueue.EnqueueAction(SaveLoginData());
 }
Exemplo n.º 27
0
 private void GotMessageRequest(string message)
 {
     messageQueue.EnqueueAction(SetMessage(message));
 }
Exemplo n.º 28
0
 public void Logout()
 {
     m_coroutineQueue.EnqueueAction(LogoutInternal());
 }
Exemplo n.º 29
0
    // [update location, check distance]

    // #1 >= 20 miles
    // you are too far... [change text]
    // get ready for a journey [change text]
    // see you in [city] [change text]
    // [return to MainUI]

    // #2 < 20 miles
    // see you in [location]
    // #3 < 5 miles
    // put on your running shoes or hop on your bike [change text, update location]
    // [update location, check distance in a loop, when half than initialized distance]
    // you are getting closer now
    // [update location, check distance in a loop, when < 100 feet]
    // congratulations! you made it!!! [change scene, open camera]

    // #4 < 100 feet
    // Be ready to see [spot]!!!

    IEnumerator Start()
    {
        textComp = GetComponent <Text>();
        // use "this" monobehaviour as the coroutine owner
        queue = new CoroutineQueue(this);
        queue.StartLoop();

        mState     = LocationState.Disabled;
        mLatitude  = 0.0f;
        mLongitude = 0.0f;
        mDistance  = 0.0f;

        spot = GlobalConstants.locations [GlobalConstants.SPOT_NAME];

        if (Input.location.isEnabledByUser)
        {
            // Start service before querying location
            Input.location.Start();
            // Wait until service initializes
            int maxWait = 20;
            while (Input.location.status == LocationServiceStatus.Initializing && maxWait > 0)
            {
                yield return(new WaitForSeconds(1));

                maxWait--;
            }
            // Service didn't initialize in 20 seconds
            if (maxWait < 1)
            {
                mState = LocationState.TimedOut;
            }
            else if (Input.location.status == LocationServiceStatus.Failed)
            {
                mState = LocationState.Failed;
            }
            else
            {
                mState     = LocationState.Enabled;
                mLatitude  = Input.location.lastData.latitude;
                mLongitude = Input.location.lastData.longitude;
//				mHorizontalAccuracy = Input.location.lastData.horizontalAccuracy;
//				mTimestamp = Input.location.lastData.timestamp;
                mDistance = Haversine();
            }
        }

        if (mState == LocationState.Enabled)
        {
            float mileTemp = mDistance * KM_2_MILE;
            float footTemp = mDistance * KM_2_FOOT;
            if (mileTemp > 20.0f)
            {
                queue.EnqueueAction(TypeText("you are too far..."));
                queue.EnqueueWait(sentencePause);
                queue.EnqueueAction(TypeText("get ready for a journey"));
                queue.EnqueueWait(sentencePause);
                queue.EnqueueAction(TypeText("see you in " + spot.GetCity()));
                Input.location.Stop();
                mState = LocationState.Stopped;
            }
            else if (mileTemp > 5.0f)
            {
                queue.EnqueueAction(TypeText("see you in " + spot.GetMuseum()));
                queue.EnqueueWait(sentencePause);
            }
            else if (footTemp > 100.0f)
            {
                queue.EnqueueAction(TypeText("put on your running shoes or hop on your bike"));
                queue.EnqueueWait(sentencePause);
            }
            else
            {
                queue.EnqueueAction(TypeText("Be ready to see " + spot.GetName()));
                queue.EnqueueWait(sentencePause);
                queue.EnqueueAction(ChangeScene("GeoCamera"));                   // this need to change scene
                Input.location.Stop();
                mState = LocationState.Stopped;
            }
        }
        else if (mState == LocationState.Disabled)
        {
            queue.EnqueueAction(TypeText("Location service not enabled"));
        }
        else if (mState == LocationState.Failed)
        {
            queue.EnqueueAction(TypeText("Unable to determine device location"));
        }
        else if (mState == LocationState.TimedOut)
        {
            queue.EnqueueAction(TypeText("Sorry! Timed out"));
        }
    }
Exemplo n.º 30
0
 public void DeletePost()
 {
     m_coroutineQueue.EnqueueAction(DeletePostInternal(m_imageSkybox.GetImageIdentifier()));
 }