Example #1
0
    IEnumerator LoadGameRoutine()
    {
        Debug.Log("First lets load wanted scene based on gamestate");
        LoadSceneBasedOnState();
        while (loadingScene)
        {
            yield return(new WaitForSeconds(0.1f));
        }
        Debug.Log("Scene has been loaded set values");
        GameDataGooglePlay gameData = Common.roundInformation.gameData;
        //FIrst load scene based on data
        RoundInformation  ri = Common.roundInformation;
        PlayerInformation pi = Common.playerInformation;

        if (pi.isOnGame)
        {
            Common.infoGUI.setNewGuestion(ri.gameData.guestion);
            if (gameData.gameState == (int)GameStates.PickingPics)
            {
                if (pi.ready)
                {
                    if (pi.myCloudImagePath.Length > 5)
                    {
                        Common.infoGUI.DisableReadyPressing();
                        Debug.Log("Loading image from cloud");
                        pi.LoadMyImageFromURL();
                        pi.SetReady();
                        Common.infoGUI.ChangeReadyButtonState(true);
                    }
                    else if (pi.myLocalImagePath.Length > 5)
                    {
                        Debug.Log("Loading image from local");
                        pi.LoadMyImageFromURL(pi.myLocalImagePath);
                        pi.ready = false;
                    }
                    else
                    {
                        pi.ready = false;
                    }
                }
            }
            if (gameData.gameState == (int)GameStates.PickingWinner)
            {
                Debug.Log("Creating picking winner scene");
                Common.DebugPopUp("GameLoader loadinggameroutine gamestate is picking winner Gonna create elements and load all images");
                Common.showWinnerMaster.CreateElements(Common.roundInformation.gameData.playerAmount);
                Common.showWinnerMaster.LoadAllImagesFromPlayerURLS();
            }
        }
        else
        {
            //LOAD MENU
        }
        yield return(new WaitForEndOfFrame());
    }
 public static IEnumerator TestGet(OnRoundInformationReceivedDelegate callback)
 {
     Debug.Log ("Starting TestGet");
     Debug.Log (BaseUrl);
     Debug.Log (UrlParameters);
     string requestStatement = serverUrl + gameRequest + "?" + idParameter + "justice";
     Debug.Log ("Requesting GET from: " + requestStatement);
     WWW www = new WWW (requestStatement);
     yield return www;
     RoundInformation roundInformation = new RoundInformation (www.text);
     callback (roundInformation);
 }
Example #3
0
    void LoadNewState(int gameState)
    {
        GameDataGooglePlay gameData = Common.roundInformation.gameData;
        //FIrst load scene based on data
        RoundInformation  ri = Common.roundInformation;
        PlayerInformation pi = Common.playerInformation;

        if (gameData.AreWeOnPictureState())
        {
            Debug.Log("Setting new guestion");
            Common.infoGUI.setNewGuestion(ri.gameData.guestion);
            Debug.Log("new guestion has been set");
            if (gameState == (int)GameStates.PickingPics)
            {
                Common.DebugPopUp("GameLoader loadingNewState routine", "Picking pics is the game state gonna check if we are ready and preload image if it exists");
                if (pi.ready)
                {
                    if (pi.myCloudImagePath.Length > 5)
                    {
                        Common.infoGUI.DisableReadyPressing();
                        Debug.Log("Loading image from cloud");
                        pi.LoadMyImageFromURL();
                        pi.SetReady();
                        Common.infoGUI.ChangeReadyButtonState(true);
                    }
                    else if (pi.myLocalImagePath.Length > 5)
                    {
                        Debug.Log("Loading image from local");
                        pi.LoadMyImageFromURL(pi.myLocalImagePath);
                        pi.ready = false;
                    }
                    else
                    {
                        pi.ready = false;
                    }
                }
            }
            if (gameData.gameState == (int)GameStates.PickingWinner)
            {
                // Common.showWinnerMaster.ClearPossiblePreviousElements();
                Debug.Log("Creating picking winner scene");
                Common.DebugPopUp("GameLoader loadinggameroutine gamestate is picking winner Gonna create elements and load all images");
                Common.showWinnerMaster.CreateElements(Common.roundInformation.gameData.playerAmount);
                Debug.Log("Loading all images from playuer URL");
                Common.showWinnerMaster.LoadAllImagesFromPlayerURLS();
            }
            if (gameData.gameState == (int)GameStates.ShowingWinner)
            {
                Common.gameMaster.DetermineWinnerAndLoadTheSceneUI();
            }
        }
    }
Example #4
0
        private GolferInformation mapEntityToInformation(Golfer golfer)
        {
            var newGolfer = new GolferInformation
            {
                Id       = golfer.Id,
                UserName = golfer.UserName,
                Name     = golfer.Name,
                Handicap = golfer.Handicap,
                IsPlus   = golfer.IsPlus,
            };

            foreach (var round in golfer.Rounds)
            {
                var newRound = new RoundInformation
                {
                    Id         = round.Id,
                    DatePlayed = round.DatePlayed,
                    Score      = round.Score,
                    NetScore   = round.NetScore,
                    GolfCourse = new GolfCoursePlayedInformation
                    {
                        Id             = round.GolfCoursePlayedId,
                        GolfClubName   = round.GolfCoursePlayed.GolfClubName,
                        GolfCourseName = round.GolfCoursePlayed.GolfCourseName,
                        TeePlayed      = new TeePlayedInformation
                        {
                            Id      = round.GolfCoursePlayed.TeesPlayed.FirstOrDefault().Id,
                            TeeName = round.GolfCoursePlayed.TeesPlayed.FirstOrDefault().TeeName,
                            Gender  = round.GolfCoursePlayed.TeesPlayed.FirstOrDefault().Gender,
                            Length  = round.GolfCoursePlayed.TeesPlayed.FirstOrDefault().Length,
                            Slope   = round.GolfCoursePlayed.TeesPlayed.FirstOrDefault().Slope,
                            Rating  = round.GolfCoursePlayed.TeesPlayed.FirstOrDefault().Rating,
                            Par     = round.GolfCoursePlayed.TeesPlayed.FirstOrDefault().Par,
                        }
                    }
                };
                newGolfer.Rounds.Add(newRound);
            }

            return(newGolfer);
        }
Example #5
0
            public override void ShowRound(RoundInformation robot1RoundInfo, RoundInformation robot2RoundInfo)
            {
                if (robot2RoundInfo.WasHit)
                    sbRound.Append(String.Format("ShowHit({0},{1});", 1, robot1RoundInfo.Weapon));
                //                else
                //                    sbRound.Append(String.Format("ShowMiss({0},{1},{2});", 1, robot1RoundInfo.Weapon, robot2RoundInfo.Shield));
                if (robot1RoundInfo.WasHit)
                    sbRound.Append(String.Format("ShowHit({0},{1});", 2, robot2RoundInfo.Weapon));
                //                else
                //                    sbRound.Append(String.Format("ShowMiss({0},{1},{2});", 2, robot2RoundInfo.Weapon, robot1RoundInfo.Shield));

                //sbRound.Append(String.Format("<span class='{0}'>W[{1}] S[{2}]</span><br />", robot1RoundInfo.WasHit ? "robotHit" : "robotMissed", robot1RoundInfo.Weapon, robot1RoundInfo.Shield));
                //rounds2.Append(String.Format("<span class='{0}'>W[{1}] S[{2}]</span><br />", robot2RoundInfo.WasHit ? "robotHit" : "robotMissed", robot2RoundInfo.Weapon, robot2RoundInfo.Shield));
            }
Example #6
0
 public abstract void ShowRound(RoundInformation robot1RoundInfo, RoundInformation robot2RoundInfo);
Example #7
0
 void OnRoundInformationReceived(RoundInformation roundInformation)
 {
     Debug.Log ("I have round information!");
 }