Example #1
0
    IEnumerator IeDecline()
    {
        var cd = new CoroutineWithData(NotificationManager.Instance, NotificationManager.Instance.IDeleteInvitations(Data.Id, null));

        yield return(cd.coroutine);

        if (cd.result.ToString() == "true" || cd.result.ToString() == "True")
        {
            NotificationManager.Instance.ShowPopUp("Invitation declined successfully", null);
//			if(Data.Message.Contains ("wants to join your society"))// Non Member's request
//			{
//				NotificationManager.Instance.SendNotificationToUser (Data.SenderId, "Your request to join society has been declined"); // send notification to presidnet/ commitee member
//			}
//			else
            if (Data.Title.Contains("Society"))
            {
                if (Data.Message.Contains("want you to join his society"))                // President's request
                {
                    NotificationManager.Instance.SendNotificationToUser(Data.SenderId, string.Format("{0} has declined your request to join your society",
                                                                                                     PlayerPrefs.GetString("UserName")));// send notification to Non Member
                }
            }
            else if (Data.Title.Contains("CoOp"))
            {
                NotificationManager.Instance.SendNotificationToUser(Data.SenderId, string.Format("{0} has declined your request to join you in CoOp Event",
                                                                                                 PlayerPrefs.GetString("UserName") /*, EventManagment.Instance.CurrentEvent.EventName*/));
            }

            Destroy(gameObject);
        }
    }
Example #2
0
    IEnumerator TryPostHighscore(string name, float score)
    {
        CoroutineWithData cd = new CoroutineWithData(this, externalScoreService.PostScores(name, score));

        yield return(cd.coroutine);

        int succeeded = (int)cd.result;

        nameInputPanel.gameObject.SetActive(false);
        gameOverHighscoreText.gameObject.SetActive(true);

        gameOverTimeText.SetText(string.Format(
                                     LocalizationManager.instance != null ? LocalizationManager.instance.GetLocalizedValue("gameover_score") : "Du hast {0} durchgehalten!",
                                     scoreManager.GetScoreString()
                                     ));

        if (succeeded == 1)
        {
            gameOverHighscoreText.SetText(
                LocalizationManager.instance != null ? LocalizationManager.instance.GetLocalizedValue("highscore_uploaded") : "Dein Highscore wurde hochgeladen!"
                );
        }
        else
        {
            gameOverHighscoreText.SetText(
                LocalizationManager.instance != null ? LocalizationManager.instance.GetLocalizedValue("highscore_upload_error") : "Highscore konnte nicht hochgeladen werden."
                );
        }
    }
    public IEnumerator GetCoopPairAfterRegistration()
    {
        HitCount++;
        Debug.LogError("Web service hitted -" + HitCount + " Times");
        VotingPairManager.Instance.viewFriends = false;
        VotingPairManager.Instance.viewStatus  = false;
        var cd = new CoroutineWithData(EventManagment.Instance, EventManagment.Instance.GetCoOpRegistration(EventManagment.Instance.CurrentEvent.Event_id));

        yield return(cd.coroutine);

        if (cd.result != null)
        {
            var Registered = (CoopRegisterPlayers)cd.result;
//			StartCoroutine (VotingPairManager.Instance.IeGetMyPair_CoOp (Registered.Player1Id, Registered.Player2Id, HitCount, false));

            var newcd = new CoroutineWithData(VotingPairManager.Instance, VotingPairManager.Instance.IeGetMyPair_CoOp(Registered.Player1Id, Registered.Player2Id, HitCount, false));
            yield return(newcd.coroutine);

            if (newcd.result != null)
            {
                EndTime        = DateTime.UtcNow;
                isTimerRunning = false;
                if (PlayerPrefs.GetInt("Tutorial_Progress") >= 26)
                {
                    AchievementsManager.Instance.CheckAchievementsToUpdate("enterUniversityEvents");
                }
            }
            else
            {
                if (HitCount < 5)
                {
                    yield return(new WaitForSeconds(TotalTimer / 4f));

                    StartCoroutine(GetCoopPairAfterRegistration());
                }
                else
                {
                    EndTime        = DateTime.UtcNow;
                    isTimerRunning = false;
                    //TODO Make a pair with AI..

                    ScreenAndPopupCall.Instance.CloseScreen();
                    ScreenAndPopupCall.Instance.CloseCharacterCamerasForEvents();
                    ScreenAndPopupCall.Instance.CloseCharacterCamera();

                    // Change according to AI Player
                    if (PlayerPrefs.GetInt("Tutorial_Progress") >= 26)
                    {
                        AchievementsManager.Instance.CheckAchievementsToUpdate("enterUniversityEvents");
                    }
                }
            }
        }
        else
        {
            ScreenAndPopupCall.Instance.CloseScreen();
            ScreenAndPopupCall.Instance.CloseCharacterCamerasForEvents();
            ScreenAndPopupCall.Instance.CloseCharacterCamera();
        }
    }
Example #4
0
    public IEnumerator UpdateTime(DateTime time, string type, int decorId, int eventId)
    {
        PositionUpdate data = new PositionUpdate();

        data.player_id = PlayerPrefs.GetInt("PlayerId");
        data.item_id   = decorId;
//        data.rotation =
        data.position = "";
        data.cool_down_time_event_id = eventId;
        if (type.ToLower().Contains("busy"))
        {
            data.cool_time    = "";
            data.is_busy_time = time.ToString();
        }
        else if (type.ToLower().Contains("cool"))
        {
            data.cool_time    = time.ToString();
            data.is_busy_time = "";
        }
        CoroutineWithData cd = new CoroutineWithData(DownloadContent.Instance, DownloadContent.Instance.SendPositions(data));

        yield return(cd.coroutine);

        if (cd.result.ToString() == "True" || cd.result.ToString() == "true")
        {
            print("updated");
        }
    }
Example #5
0
    public IEnumerator GetCharacterCustomisations()
    {
        playerInfo.Name      = PlayerPrefs.GetString("UserName");
        playerInfo.Username  = PlayerPrefs.GetString("UserName");
        playerInfo.EmailId   = PlayerPrefs.GetString("UserEmail");
        playerInfo.player_id = PlayerPrefs.GetInt("PlayerId");


        CoroutineWithData cd = new CoroutineWithData(this, GetCharacterData(PlayerPrefs.GetInt("PlayerId")));

        yield return(cd.coroutine);

        if (cd.result != null)
        {
            if (PlayerPrefs.GetString("CharacterType") == "Male")
            {
                PlayerManager.Instance.MainCharacter = CharacterCustomizationAtStart.Instance.MaleCharacter;
            }
            else
            {
                PlayerManager.Instance.MainCharacter = CharacterCustomizationAtStart.Instance.FemaleCharacter;
            }

            CharacterCustomizationAtStart.Instance.SelectedCharacter = PlayerManager.Instance.MainCharacter;

            StartCoroutine(UpdateCharacter());
        }
        else
        {
            StartCoroutine(GetCharacterCustomisations());
        }
    }
Example #6
0
    private IEnumerator registerUser(string login, string password, string repeatedPassword, string email)
    {
        CoroutineWithData cd = new CoroutineWithData(this, databaseUtils.RegisterUser(login, password, repeatedPassword, email));

        yield return(cd.coroutine);

        try
        {
            string registrationReceivedMessage = (string)cd.result;
            if ("0".Equals(registrationReceivedMessage))
            {
                m_dialogText = "Account has been created. You can log in";
                clearCredentialsForm();
                updateCredentialsInForm();
            }
            else
            {
                m_dialogText = registrationReceivedMessage;
            }
            updateDialogText();
            dialogText.SetActive(true);
        }
        catch (System.Exception)
        {
            m_dialogText = "Error while connecting to database";
            updateDialogText();
            dialogText.SetActive(true);
        }
    }
Example #7
0
    public IEnumerator ChangePresident(GameObject go)
    {
        CoroutineWithData cd = new CoroutineWithData(SocietyManager.Instance, SocietyManager.Instance.IeSwapPresident(go.name));

        yield return(cd.coroutine);

        if (cd.result.ToString() == "true" || cd.result.ToString() == "True")
        {
            SocietyManager.Instance.ShowPopUp("President changed successfully.", () => {
                SocietyDescriptionController.Instance.SocietyMemberList(true);
            });

            yield return(SocietyManager.Instance.IGetAllPlayers(SocietyManager.Instance.SelectedSociety.Id));

            SocietyManager.Instance._allMembers.Sort();
            foreach (var obj in SocietyManager.Instance._allMembers)
            {
                yield return(NotificationManager.Instance.StartCoroutine(NotificationManager.Instance.ISendNotificationtoUser(obj.player_id,
                                                                                                                              string.Format("New president of society \"{0}\" is \"{1}\"", SocietyManager.Instance.SelectedSociety.Name, SocietyManager.Instance._allMembers[0].player_name))));
            }
        }

        else
        {
            SocietyManager.Instance.ShowPopUp("Failed to change the president. Please try again later.", () => SocietyDescriptionController.Instance.SocietyMemberList(true));
        }
    }
Example #8
0
    IEnumerator IeDemote()
    {
        int presidentId = 0;

        foreach (var _member in SocietyManager.Instance._allMembers)
        {
            if (_member.role_id == 0)
            {
                presidentId = _member.player_id;
            }
        }
        var cd = new CoroutineWithData(SocietyManager.Instance, SocietyManager.Instance.IeUpdateRole(_thisMember.role_id + 1, _thisMember.player_id, _thisMember.level));

        yield return(cd.coroutine);

        if (cd.result.ToString() == "true" || cd.result.ToString() == "True")
        {
            NotificationManager.Instance.SendNotificationToUser(_thisMember.player_id, string.Format("You have been demoted in \"{0}\" society", SocietyManager.Instance.SelectedSociety.Name));
            NotificationManager.Instance.SendNotificationToUser(presidentId, string.Format(_thisMember.player_name + " has been demoted in \"{0}\" society", SocietyManager.Instance.SelectedSociety.Name));
        }
        else
        {
            SocietyManager.Instance.ShowPopUp("Failed to demote the player. Please try again.", () => SocietyDescriptionController.Instance.SocietyMemberList(true));
        }
        yield return(null);
    }
Example #9
0
        private IEnumerator UpdateSubFamilies(FamilyController behaviour, string relatedFamilyId)
        {
            GameObject famObj = FamilyInstanceLibrary.GetFamily(relatedFamilyId);

            famObj.SetActive(false);

            CoroutineWithData <Message> cd = new CoroutineWithData <Message>(
                behaviour,
                this.ServerRequestCoroutine(new Message
            {
                Type = "GET",
                Data = JsonConvert.SerializeObject(new
                {
                    Id = relatedFamilyId
                })
            })
                );

            yield return(cd.coroutine);

            Message getResponse = cd.result;

            FamilyInstance fam = JObject.Parse(getResponse.Data).ToObject <FamilyInstance>();

            famObj.GetComponent <FamilyController>().UpdateInstanceData(fam);

            famObj.SetActive(true);
        }
    public IEnumerator GetSpriteFromAtlas(string name)
    {
        CoroutineWithData checkAtlasExist = new CoroutineWithData(this, CoCheckAtlasExist(name, null));

        yield return(checkAtlasExist.coroutine);

        Debug.Log("result is " + checkAtlasExist.result);
        bool   atlasExist = (bool)checkAtlasExist.result;
        string atlasAddress;

        if (atlasExist)
        {
            atlasAddress = GetAtlasAddressFromPictureName(name);
        }
        else
        {
            atlasAddress = GetAtlasAddressFromPictureName("OTHER");
        }

        var asyncOperationHandle = Addressables.LoadAssetAsync <SpriteAtlas>(atlasAddress);

        asyncOperationHandleQueues.Enqueue(asyncOperationHandle);
        yield return(asyncOperationHandle);

        if (asyncOperationHandle.Result != null)
        {
            yield return(asyncOperationHandle.Result.GetSprite(name));
        }
    }
Example #11
0
        public IEnumerator test()
        {
            //UNIT TESTING ZONE:
            CoroutineWithData cd = new CoroutineWithData(this, GetUserByName("carla"));

            yield return(cd.coroutine);

            UserVO testuser = cd.result as UserVO;
            //UNIT TESTING ZONE:
            CoroutineWithData cd1 = new CoroutineWithData(this, GetUserSubjects(testuser.subjects));

            yield return(cd1.coroutine);

            IList <SubjectVO> testsubs = cd1.result as List <SubjectVO>;
            CoroutineWithData cd2      = new CoroutineWithData(this, GetSubjectContentList(testsubs[0]));

            yield return(cd2.coroutine);

            IList <ContentVO> contents = cd2.result as List <ContentVO>;
            CoroutineWithData cd3      = new CoroutineWithData(this, GetPointerByContent(contents[0]));

            yield return(cd3.coroutine);

            PointerVO         pointer = cd3.result as PointerVO;
            CoroutineWithData cd4     = new CoroutineWithData(this, GetPointerBySubject(testsubs[0]));

            yield return(cd4.coroutine);

            PointerVO         pointer1 = cd4.result as PointerVO;
            CoroutineWithData cd5      = new CoroutineWithData(this, GetUserGroups(testuser));

            yield return(cd5.coroutine);

            IList <GroupVO> groups = cd5.result as List <GroupVO>;
        }
Example #12
0
        internal IEnumerator GetAccessTokens()
        {
            this.ClearAccessTokenCache();
            Dictionary <string, string> parameters = this.GetParams();

            CoroutineWithData cd = new CoroutineWithData(owner, get("tokens", parameters));

            yield return(cd.Coroutine);

            string tokensStr = (string)cd.Result;

            Debug.Log("getAccessTokens() tokensStr: " + tokensStr);
            this.tokenCache = ResponseToTokenCache(tokensStr);

            yield return(this.tokenCache.Count);


            // Is this client already authorized to use the MERCHANT facade?
            if (!ClientIsAuthorized(FACADE_MERCHANT))
            {
                Debug.Log("initialize():client Not authorized yet.Getting authorized.");
                // Get MERCHANT facade authorization.
                yield return(AuthorizeClient(pairingCode));
            }
            else
            {
                Debug.Log("initialize():client Already Authorized.");
            }
        }
Example #13
0
        public IEnumerator CreateInvoice(InvoiceBtcpay invoice, Action <InvoiceBtcpay> invoiceAction)
        {
            invoice.Token = this.GetAccessToken(FACADE_MERCHANT);//get token by facade type
            invoice.Guid  = Guid.NewGuid().ToString();
            String json = JsonConvert.SerializeObject(invoice);

            Debug.Log("createInvoice(): About to post an initial Invoice " + json);

            CoroutineWithData cd = new CoroutineWithData(owner, Post("invoices", json, true));

            yield return(cd.Coroutine);

            string responseStr = (string)cd.Result;

            Debug.Log("createInvoice():  response:" + responseStr);

            JsonConvert.PopulateObject(this.ResponseToJsonString(responseStr), invoice);
            Debug.Log("createInvoice():  responsejson to Invoice Object done token1:id=" + invoice.Id + " token=" + invoice.Token + " json=" + JsonConvert.SerializeObject(invoice) + " toString:" + invoice.ToString());
            invoice = JsonConvert.DeserializeObject <InvoiceBtcpay>(this.ResponseToJsonString(responseStr));
            Debug.Log("createInvoice():  responsejson to Invoice Object done token2:id=" + invoice.Id + " token=" + invoice.Token + " json=" + JsonConvert.SerializeObject(invoice) + " toString:" + invoice.ToString());

            // Track the token for this invoice
            this.CacheToken(invoice.Id, invoice.Token);
            Debug.Log("createInvoice():  Taking InvoiceAction callback BEFORE");
            invoiceAction(invoice);
            Debug.Log("createInvoice():  Taking InvoiceAction callback AFTER");
        }
    public IEnumerator Executar(Vector2 initialPosition)
    {
        int[,] sol = new int[n, n];


        for (int x = 0; x < n; x++)
        {
            for (int y = 0; y < n; y++)
            {
                sol[x, y] = -1;
            }
        }


        int[] xMove = { 2,   1, -1, -2,
                        -2, -1,  1, 2 };
        int[] yMove = { 1,   2,  2, 1,
                        -1, -2, -2, -1 };

        sol[(int)initialPosition.x, (int)initialPosition.y] = 0;


        CoroutineWithData cd = new CoroutineWithData(this, solveKTUtil((int)initialPosition.x, (int)initialPosition.y, 1, sol, xMove, yMove));

        yield return(cd.coroutine);

        if ((bool)cd.result == false)
        {
            Debug.Log("Solution does not exist");
        }
        else
        {
            printSolution(sol);
        }
    }
Example #15
0
        IEnumerator RecordMovementData()
        {
            r_ControllerLog = new List <float>();
            l_ControllerLog = new List <float>();
            headsetLog      = new List <float>();
            Arithmetic arithmetic = new Arithmetic();

            while (isRecording)
            {
                // Calculate and store speed of each piece of hardware
                CoroutineWithData r_cd = new CoroutineWithData(this, arithmetic.getSpeedOfObject(r_Controller, checksPerSecond));
                CoroutineWithData l_cd = new CoroutineWithData(this, arithmetic.getSpeedOfObject(l_Controller, checksPerSecond));
                CoroutineWithData h_cd = new CoroutineWithData(this, arithmetic.getSpeedOfObject(headset, checksPerSecond));
                yield return(r_cd.coroutine);

                yield return(l_cd.coroutine);

                yield return(h_cd.coroutine);

                r_ControllerLog.Add((float)r_cd.result);
                l_ControllerLog.Add((float)l_cd.result);
                headsetLog.Add((float)h_cd.result);
            }

            // Print results
            print("Right controller average speed: " + r_ControllerLog.Average());
            print("Left controller average speed: " + l_ControllerLog.Average());
            print("Headset average speed: " + headsetLog.Average());
        }
Example #16
0
    // Use this for initialization
    public IEnumerator Start()
    {
        ////////////////////////////////////////////////////////
        ///////////  API EXAMPLES  /////////////////////////////
        ////////////////////////////////////////////////////////

        CoroutineWithData cd = new CoroutineWithData(this, GetRecent(2));

        /*
         * CoroutineWithData cd = new CoroutineWithData(this,
         *  Insert(
         *      "test","https://poly.google.com/view/16EC3rK_AZu",
         *      "google poly",
         *      32, -110
         *  )
         * );
         */

        //CoroutineWithData cd = new CoroutineWithData(this, RadiusSelect(0.001f, 32f, -110f));

        //CoroutineWithData cd = new CoroutineWithData(this, Delete("user","test"));

        yield return(cd.coroutine);

        data = (ApiObject[])cd.result;
        ////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////


        // parse timestamp string from server into DateTime obj
        // DateTime myDate = DateTime.ParseExact(data[0].timestamp, "yyyy-MM-dd HH:mm:ss", null);
        // Debug.Log(myDate.ToString());
    }
    private IEnumerator UpdateScores()
    {
        string playerName = PlayerPrefs.GetString("playerName");

        if (!playerName.Equals("Guest"))
        {
            int playerId = PlayerPrefs.GetInt("playerId");

            CoroutineWithData cd = new CoroutineWithData(this, databaseUtils.RetrievePlayerScores(playerId));
            yield return(cd.coroutine);

            string receivedMessage = (string)cd.result;

            if (receivedMessage[0] == '0')
            {
                string[] rows = receivedMessage.Split('\n');

                for (int i = 1; i < rows.Length; i++)
                {
                    string row     = rows[i];
                    int    worldId = int.Parse(row.Split('\t')[0]);
                    string score   = row.Split('\t')[1];
                    scores[worldId].GetComponent <TMP_Text>().text = score;
                }
            }
        }
    }
Example #18
0
        IEnumerator BeginWebsocket()
        {
            CoroutineWithData cd = new CoroutineWithData(this, Stream.getStreamToken());

            yield return(cd.coroutine);

            string token = (string)cd.result;

            WebSocket w = new WebSocket(new Uri("ws://livestats.proxy.lolesports.com/stats?jwt=" + token));

            yield return(StartCoroutine(w.Connect()));

            while (true)
            {
                string reply = w.RecvString();
                if (reply != null)
                {
                    Debug.Log("Received: " + reply);
                    JSONNode liveDataJSON = JSON.Parse(reply);
                    // Process data
                    // Do what you want here
                }
                if (w.error != null)
                {
                    Debug.LogError("Error: " + w.error);
                    break;
                }
                yield return(0);
            }
            w.Close();
        }
    private IEnumerator RetrieveTopScores()
    {
        string currPlayerName = PlayerPrefs.GetString("playerName");

        if (!currPlayerName.Equals("Guest"))
        {
            CoroutineWithData cd = new CoroutineWithData(this, databaseUtils.RetrieveTopScores(m_top, currPlayerName, m_actualLevelId));
            yield return(cd.coroutine);

            string   receivedMessage = (string)cd.result;
            string[] rows            = receivedMessage.Split('\n');

            ClearLadderboards();

            for (int i = 0; i < rows.Length; i++)
            {
                if (i == m_top)
                {
                    AddSkippingRow();
                }

                string row        = rows[i];
                string rank       = row.Split('\t')[0];
                string playerName = row.Split('\t')[1];
                string score      = row.Split('\t')[2];
                AddPlayerToLadderboards(rank, playerName, score);
            }

            RemoveLastNewLinesInLeaderboards();
            RenderLadderboards();
        }
    }
    IEnumerator solveKTUtil(int x, int y, int movei, int[,] sol, int[] xMove, int[] yMove)
    {
        Debug.Log(movei);
        int k, next_x, next_y;

        if (movei == n * n)
        {
            yield return(true);
        }

        for (k = 0; k < 8; k++)
        {
            next_x = x + xMove[k];
            next_y = y + yMove[k];
            if (isSafe(next_x, next_y, sol))
            {
                sol[next_x, next_y] = movei;
                CoroutineWithData cd = new CoroutineWithData(this, solveKTUtil(next_x, next_y, movei + 1, sol, xMove, yMove));
                yield return(cd.coroutine);

                if ((bool)cd.result)
                {
                    yield return(true);
                }
                else
                {
                    sol[next_x, next_y] = -1;
                }
            }
            yield return(null);
        }

        yield return(false);
    }
Example #21
0
    IEnumerator RefreshHighScoreTable()
    {
        highscoreTextLoading.enabled    = true;
        highscoreTextConnection.enabled = false;
        CoroutineWithData cd = new CoroutineWithData(this, ScoreUploader.GetScores());

        yield return(cd.coroutine);

        List <string[]> highscoreTable = (List <string[]>)cd.result;

        highscoreTextPos.text        = "";
        highscoreTextNames.text      = "";
        highscoreTextScores.text     = "";
        highscoreTextLoading.enabled = false;
        if (highscoreTable.Count == 0)
        {
            highscoreTextConnection.enabled = true;
        }
        else
        {
            highscoreTextConnection.enabled = false;

            for (int i = 0; i < highscoreTable.Count; ++i)
            {
                highscoreTextPos.text    += (i + 1).ToString() + "\n";
                highscoreTextNames.text  += highscoreTable[i][0] + "\n";
                highscoreTextScores.text += highscoreTable[i][1] + "\n";
            }
        }
    }
Example #22
0
    /// <summary>
    /// Spawns the brain for one subject- this may be "fsaverage_joel", the average brain.  This will try to use assetBundles and call ObjSpawn if it can't.
    /// </summary>
    /// <returns>The spawn.</returns>
    /// <param name="subject">Subject.</param>
    /// <param name="average_brain">If set to <c>true</c> average brain.</param>
    public override IEnumerator Spawn(string subject, bool average_brain = false)
    {
        CoroutineWithData subjectListRequest = new CoroutineWithData(this, RhinoRequestor.AssetBundleRequest(subject));

        yield return(subjectListRequest.coroutine);

        Debug.Log(subjectListRequest.result);
        if (subjectListRequest.result == null)
        {
            loadingText.text = "AssetBundle not found. Performing alternative (slower) load. Please wait.";
            ObjSpawn(subject, average_brain);
            yield break;
        }
        AssetBundle bundle      = (AssetBundle)subjectListRequest.result;
        GameObject  brainPrefab = bundle.LoadAsset <GameObject>(subject);
        GameObject  brain       = Instantiate(brainPrefab);

        brain.transform.parent = gameObject.transform;
        dk             = brain.transform.GetChild(1).gameObject;
        hcp            = brain.transform.GetChild(0).gameObject;
        dkLeftParent   = dk.transform.GetChild(0).gameObject;
        dkRightParent  = dk.transform.GetChild(1).gameObject;
        hcpLeftParent  = hcp.transform.GetChild(0).gameObject;
        hcpRightParent = hcp.transform.GetChild(1).gameObject;

        currentBundle = bundle;

        //due to weirdness, flip everything
        //gameObject.transform.localScale = new Vector3 (-gameObject.transform.localScale.x, gameObject.transform.localScale.y, gameObject.transform.localScale.z);

        hcp.SetActive(false);
    }
Example #23
0
    public IEnumerator SetPosition()
    {
        PositionUpdate data = new PositionUpdate();

        data.player_id = PlayerPrefs.GetInt("PlayerId");
        foreach (var downloaded_item in DownloadContent.Instance.downloaded_items)
        {
            if (downloaded_item.Name.Trim('"') == decorInfo.Name.Trim('"'))
            {
                data.item_id = downloaded_item.Item_id;
            }
        }

        data.position = SerializeVector3Array(this.transform.position);
        data.rotation = sprites.FindIndex(x => x == gameObject.GetComponent <SpriteRenderer> ().sprite) + "_" + Placed;
        data.cool_down_time_event_id = 0;
        data.cool_time    = "";
        data.is_busy_time = "";

        CoroutineWithData cd = new CoroutineWithData(DownloadContent.Instance, DownloadContent.Instance.SendPositions(data));

        yield return(cd.coroutine);

        if (cd.result.ToString() == "True" || cd.result.ToString() == "true")
        {
            this.transform.GetChild(1).gameObject.SetActive(false);
            this.gameObject.GetComponent <DragSnap> ().enabled = false;
            PlayerPrefs.SetInt("Direction" + decorInfo.Name, direction);
            objPosition = this.transform.position;
            PlayerPrefs.SetString("ObjPosition" + decorInfo.Name, SerializeVector3Array(objPosition));
            ScreenAndPopupCall.Instance.placementbutton.onClick.RemoveAllListeners();
            ScreenAndPopupCall.Instance.placementbutton.gameObject.SetActive(false);
            ScreenAndPopupCall.Instance.placementbutton.interactable = false;

            if (mouseDown != 0)
            {
                OnMouseDown();
            }

            //		GameManager.Instance.AddExperiencePoints (2f);
            if (!tutorial._SofaPlaced && tutorial.purchaseSofa > 1)
            {
                tutorial.PurchaseSofa();
            }

            if (!tutorial._QuestAttended && tutorial._PublicAreaAccessed && tutorial.questAttended > 8)
            {
//				tutorial.QuestAttendingStart ();
            }
//			transform.GetComponent<DragSnap> ().FindNeartGameObject ();
            /// Bug fixed of Sprint 6 on Date 16/11/2016
//			for (int i = 0; i < DecorController.Instance.PlacedDecors.Count; i++) {
            this.GetComponent <DragSnap> ().FindNearGameObjectFinal(this.transform.FindChild("New Sprite"));
            transform.FindChild("Check").GetComponent <SpriteRenderer> ().color = Color.white;
//				print (i);
//			}
        }
        transform.FindChild("Check").gameObject.SetActive(false);
    }
Example #24
0
    IEnumerator Purchase()
    {
        if (data.Price < PlayerPrefs.GetInt("Money"))
        {
            var button = GameObject.Find("EventSystem").GetComponent <EventSystem> ().currentSelectedGameObject;
            button.GetComponent <Button> ().interactable = false;


            int    item_id = 0;
            string cat     = "";
            string sub_cat = "";
            foreach (var downloadeditem in DownloadContent.Instance.downloaded_items)
            {
                if (downloadeditem.Name.Trim('"') == data.Name.Trim('"'))
                {
                    item_id = downloadeditem.Item_id;
                    cat     = downloadeditem.Category;
                    sub_cat = downloadeditem.SubCategory;
                }
            }

            CoroutineWithData cd = new CoroutineWithData(DownloadContent.Instance, DownloadContent.Instance.SetPurchasingData(item_id, cat, sub_cat));
            yield return(cd.coroutine);

            if (cd.result.ToString() == "true" || cd.result.ToString() == "True")
            {
                HireRoommate();
//				GameManager.Instance.AddExperiencePoints (10.0f);

                GameObject.Destroy(this.gameObject);

                ScreenManager.Instance.ClosePopup();
                ScreenManager.Instance.MoveScreenToBack();
                InitFlatmateUi();
//				GameManager.Instance.AddExperiencePoints (5.0f);
                GameManager.Instance.SubtractCoins(data.Price);
                var Tut = GameManager.Instance.GetComponent <Tutorial> ();
                if (Tut.recruitFlatmate == 6)
                {
                    Tut.RecruitFlatmate();
                }
                if (PlayerPrefs.GetInt("Tutorial_Progress") >= 26)
                {
                    AchievementsManager.Instance.CheckAchievementsToUpdate("flatmateRecruited");
                }

                ScreenAndPopupCall.Instance.CloseCharacterCamera();
            }
            else
            {
                button.GetComponent <Button> ().interactable = true;
                ShowPopUpError();
            }
        }
        else
        {
            ShowPopUpLessCoins();
        }
    }
Example #25
0
    IEnumerator LoadAssetBundles()
    {
        CoroutineWithData cd = new CoroutineWithData(this, _AssetBundleManager.GetObjectArrFromAssetBundle(assetBoundleFilePath, "AssetBundles"));

        yield return(cd.coroutine);

        PrimitiveFigureArr = cd.result as Object[];
    }
Example #26
0
    public IEnumerator ReturnScores()
    {
        CoroutineWithData cd = new CoroutineWithData(this, GetScores( ));

        yield return(cd.coroutine);

        GameObject.Find("Score List").GetComponent <HighScoreLoader>().DisplayScores((string[][])cd.result);
        //Debug.Log("result is " + cd.result);  //  'success' or 'fail'
    }
Example #27
0
    private IEnumerator FileRequestToObj(string subjectName, string fileName)
    {
        CoroutineWithData objRequest = new CoroutineWithData(this, RhinoRequestor.FileRequest(subjectName, fileName));

        yield return(objRequest.coroutine);

        byte[] objData = (byte[])objRequest.result;
        BuildBrainPiece(objData, fileName);
    }
Example #28
0
        IEnumerator GetLeagueBySlug()
        {
            CoroutineWithData cd = new CoroutineWithData(this, League.League.getLeague("worlds"));

            yield return(cd.coroutine);

            // Need to determine how to format this data before this can be completed
            Debug.Log("=============================");
        }
    public IEnumerator GetAssetBundleManifest(string url, string ManifestFileName)
    {
        CoroutineWithData cd = new CoroutineWithData(this, GetAssetBundle(url, "AssetBundleManifest"));

        yield return(cd.coroutine);

        AssetBundleManifest resultObj = cd.result as AssetBundleManifest;

        yield return(resultObj);
    }
Example #30
0
	public IEnumerator LogIn_enum (){
		string user = input_username.GetComponent<InputField>().text;
		string password = input_password.GetComponent<InputField>().text;
		CoroutineWithData cd = new CoroutineWithData(this,query.LogIn(user,password));
		yield return cd.coroutine;
		//Debug.Log (cd.result.ToString());
		session = (Session)cd.result;
		Debug.Log("Current user: " + session.currentUser.username);
		//Application.LoadLevel();
	}
    public IEnumerator signIn()
    {
        CoroutineWithData result = new CoroutineWithData(this, wwwScript.PostSignIn(username.text, password.text));

        yield return(result.coroutine);

        JSONNode parsedAnnotation = JSON.Parse(result.result.ToString());

        authenticate(parsedAnnotation ["token"].ToString());
    }
Example #32
0
	public IEnumerator unit_testing () {
		CoroutineWithData cd = new CoroutineWithData(this, query.test());
		yield return cd.coroutine;
	}