Esempio n. 1
0
    public void OnClick()
    {
        GetComponent <AudioSource>().clip = clickBtn;
        GetComponent <AudioSource>().Play();

        if (!passText.Text.ToString().Equals(""))
        {
            HTTP.Client.Instance.Configure(new HTTP.Settings(TriviaService.GetHostAddress()).Protocol(HTTP.Protocol.HTTP));

            new HTTP.Request(TriviaService.GetHttpFolderPath() + "update_pass.php?user_id=" + GameConstant.UserId + "&user_pass="******"Pass not valid.";
            invalidText.IsVisible = true;
        }
    }
Esempio n. 2
0
    public void OnClick()
    {
        GetComponent <AudioSource>().clip = clickBtn;
        GetComponent <AudioSource>().Play();

        if (!emailText.Text.ToString().Equals("") && !passText.Text.ToString().Equals(""))
        {
            HTTP.Client.Instance.Configure(new HTTP.Settings(TriviaService.GetHostAddress()).Protocol(HTTP.Protocol.HTTP));

            new HTTP.Request(TriviaService.GetHttpFolderPath() + "login_user.php?user_name=" + emailText.Text.ToString() + "&user_pass="******"OWN";
                    GameConstant.UserEmail   = loginReply.data[0].user_email;
                    GameConstant.UserCountry = loginReply.data[0].user_country;
                    GameConstant.IsMusic     = loginReply.data[0].ismusic;
                    GameConstant.IsSound     = loginReply.data[0].issound;
                    //Debug.Log(gameConsatant.user_country);
                    SceneManager.LoadScene("TriviaGamePlay");
                }
                else
                {
                    invalidText.IsVisible = true;
                }
            })
            .Send();
        }
    }
Esempio n. 3
0
    void Update()
    {
        //progress.AnimationCompleted += (dfTweenPlayableBase sender) => {
        if (!progress.IsPlaying)
        {
            Debug.Log("done");
            CategoryConstant.GameType = gameType;

            if (CategoryConstant.GameType.Equals("fun"))
            {
                HTTP.Client.Instance.Configure(new HTTP.Settings(TriviaService.GetHostAddress()).Protocol(HTTP.Protocol.HTTP));

                new HTTP.Request(TriviaService.GetHttpFolderPath() + "get_player_fun_points.php?prize_id=" + CategoryConstant.PrizeId + "&th_cat_id=" + CategoryConstant.MainCategoryId + "&sec_cat_id=" + CategoryConstant.SubCategoryId + "&cat_id=" + CategoryConstant.GrandCategoryId + "&game_user_id=" + GameConstant.UserId + "&game_user_type=" + GameConstant.UserType)
                .OnReply((reply) => {
                    pointReply = JsonConvert.DeserializeObject <PointReply>(reply.DataAsString);

                    if (pointReply.success == 1)
                    {
                        GameConstant.FunHighScore = pointReply.points;
                    }
                    else
                    {
                        GameConstant.FunHighScore = 0;
                    }
                })
                .Send();
            }

            GameConstant.CurrentScore = 0;
            SceneManager.LoadScene("TriviaStratPlay");
            //};
        }
    }
Esempio n. 4
0
    void Start()
    {
        notFoundPanel.IsVisible = false;
        dfScrollPanel leaderPanel = GetComponent <dfScrollPanel> ();

        //categoryPanel.Anchor = dfAnchorStyle.All;
        HTTP.Client.Instance.Configure(new HTTP.Settings(TriviaService.GetHostAddress()).Protocol(HTTP.Protocol.HTTP));

        new HTTP.Request(TriviaService.GetHttpFolderPath() + "get_game_leaderboard.php?prize_id=" + CategoryConstant.PrizeId)
        .OnReply((reply) => {
            LeaderBoardReply leaderReply = JsonConvert.DeserializeObject <LeaderBoardReply>(reply.DataAsString);
            if (leaderReply.success == 1)
            {
                foreach (LeaderBoardData data in leaderReply.data)
                {
                    LeaderBoard instance = leaderPanel.AddPrefab(Prefab.gameObject).GetComponent <LeaderBoard>();
                    //instance.GetComponent<dfPanel>().Anchor = dfAnchorStyle.All;

                    instance.Data = data;
                    instance.start();
                }
                loaderPanel.IsVisible = false;
            }
            else
            {
                notFoundPanel.IsVisible = true;
                loaderPanel.IsVisible   = false;
            }
        })
        .Send();
    }
Esempio n. 5
0
    void Start()
    {
        HTTP.Client.Instance.Configure(new HTTP.Settings(TriviaService.GetHostAddress()).Protocol(HTTP.Protocol.HTTP));

        notFoundPanel.IsVisible = false;
        dfScrollPanel winnerPanel = GetComponent <dfScrollPanel> ();

        //categoryPanel.Anchor = dfAnchorStyle.All;

        new HTTP.Request(TriviaService.GetHttpFolderPath() + "get_game_winners.php")
        .OnReply(reply =>
        {
            WinnerReply winReply = JsonConvert.DeserializeObject <WinnerReply>(reply.DataAsString);
            if (winReply.success == 1)
            {
                foreach (WinnerData data in winReply.data)
                {
                    Winner instance = winnerPanel.AddPrefab(Prefab.gameObject).GetComponent <Winner>();
                    //instance.GetComponent<dfPanel>().Anchor = dfAnchorStyle.All;

                    instance.Data = data;
                    instance.start();
                }
                loaderPanel.IsVisible = false;
            }
            else
            {
                notFoundPanel.IsVisible = true;
                loaderPanel.IsVisible   = false;
            }
        })
        .Send();
    }
Esempio n. 6
0
    void Start()
    {
        HTTP.Client.Instance.Configure(new HTTP.Settings(TriviaService.GetHostAddress()).Protocol(HTTP.Protocol.HTTP));

        new HTTP.Request(TriviaService.GetHttpFolderPath() + "all_categories.php?restaurant_id=5")
        .OnReply((reply) => {
            /*
             * JObject obj = JObject.Parse(reply.DataAsString);
             * JArray list = obj["data"] as JArray;
             * foreach (JToken token in list)
             * {
             *      CatagoryData data =	JsonConvert.DeserializeObject<CatagoryData>(token.ToString());
             *      Catagory instance = Instantiate(Prefab) as Catagory;
             *      instance.Data = data;
             * }
             */
            CatagoryReply catReply = JsonConvert.DeserializeObject <CatagoryReply>(reply.DataAsString);
            foreach (CatagoryData data in catReply.data)
            {
                Catagory instance = Instantiate(Prefab) as Catagory;
                instance.Data     = data;
            }
        })
        .Send();
    }
Esempio n. 7
0
    // Use this for initialization
    void Start()
    {
        //topTitle.Text = categoryConstant.MainCategoryName;
        notFoundPanel.IsVisible = false;
        dfScrollPanel categoryPanel = GetComponent <dfScrollPanel> ();

        HTTP.Client.Instance.Configure(new HTTP.Settings(TriviaService.GetHostAddress()).Protocol(HTTP.Protocol.HTTP));

        new HTTP.Request(TriviaService.GetHttpFolderPath() + "second_categories.php?parent_id=" + CategoryConstant.MainCategoryId)
        .OnReply((reply) => {
            SubCatagoryReply catReply = JsonConvert.DeserializeObject <SubCatagoryReply>(reply.DataAsString);
            if (catReply.success == 1)
            {
                foreach (SubCatagoryData data in catReply.data)
                {
                    SubCatagory instance = categoryPanel.AddPrefab(Prefab.gameObject).GetComponent <SubCatagory>();

                    //MainCatagory instance = Instantiate(Prefab) as MainCatagory;
                    instance.Data = data;
                    instance.start();
                }
                loaderPanel.IsVisible = false;
            }
            else
            {
                //	notFoundPanel.IsVisible = true;
                //	loaderPanel.IsVisible = false;

                CategoryConstant.SubCategoryId   = 0;
                CategoryConstant.GrandCategoryId = 0;
                SceneManager.LoadScene("TriviaGameSponsor");
            }
        })
        .Send();
    }
Esempio n. 8
0
    void Start()
    {
        HTTP.Client.Instance.Configure(new HTTP.Settings(TriviaService.GetHostAddress()).Protocol(HTTP.Protocol.HTTP));

        notFoundPanel.IsVisible = false;
        dfScrollPanel historyPanel = GetComponent <dfScrollPanel> ();

        //categoryPanel.Anchor = dfAnchorStyle.All;

        new HTTP.Request(TriviaService.GetHttpFolderPath() + "get_user_game_history.php?game_user_id=" + GameConstant.UserId + "&game_user_type=" + GameConstant.UserType)
        .OnReply((reply) => {
            HistoryReply hReply = JsonConvert.DeserializeObject <HistoryReply>(reply.DataAsString);
            if (hReply.success == 1)
            {
                foreach (HistoryData data in hReply.data)
                {
                    History instance = historyPanel.AddPrefab(Prefab.gameObject).GetComponent <History>();

                    instance.Data = data;
                    instance.start();
                }
                loaderPanel.IsVisible = false;
            }
            else
            {
                notFoundPanel.IsVisible = true;
                loaderPanel.IsVisible   = false;
            }
        })
        .Send();
    }
Esempio n. 9
0
    //private string url = "login_user.php";
    //?app_user_name=saqib&app_user_pass=1234";

    public void OnClick()
    {
        if (!emailText.Text.ToString().Equals("") && !passText.Text.ToString().Equals(""))
        {
            HTTP.Client.Instance.Configure(new HTTP.Settings(TriviaService.GetHostAddress()).Protocol(HTTP.Protocol.HTTP));

            new HTTP.Request(TriviaService.GetHttpFolderPath() + "login_user.php?user_name=" + emailText.Text.ToString() + "&user_pass="******"OWN";

                    Tween.Play();
                    Tween.TweenCompleted += (dfTweenPlayableBase sender) => {
                        SceneManager.LoadScene("introduction");
                    };
                }
                else
                {
                }
            })
            .Send();
        }
    }
Esempio n. 10
0
    public void OnClick()
    {
        GetComponent <AudioSource>().clip = clickBtn;
        GetComponent <AudioSource>().Play();

        if (!emailText.Text.ToString().Equals("email") && !usernameText.Text.ToString().Equals("username"))
        {
            if (!emailText.Text.ToString().Equals("") && !passText.Text.ToString().Equals("") && !usernameText.Text.ToString().Equals("") && !rpassText.Text.ToString().Equals(""))
            {
                if (passText.Text.ToString().Equals(rpassText.Text.ToString()))
                {
                    HTTP.Client.Instance.Configure(new HTTP.Settings(TriviaService.GetHostAddress()).Protocol(HTTP.Protocol.HTTP));

                    new HTTP.Request(TriviaService.GetHttpFolderPath() + "register_user.php?user_name=" + usernameText.Text.ToString() + "&user_pass="******"&user_email=" + emailText.Text.ToString() + "&user_type=OWN")
                    .OnReply(reply =>
                    {
                        RegisterReply registerReply = JsonConvert.DeserializeObject <RegisterReply>(reply.DataAsString);
                        if (registerReply.success == 1)
                        {
                            GameConstant.UserId    = usernameText.Text.ToString();
                            GameConstant.UserType  = "OWN";
                            GameConstant.UserEmail = emailText.Text.ToString();
                            StartCoroutine(UploadImg(usernameText.Text.ToString()));
                        }
                        else
                        {
                            invalidText.Text      = registerReply.message.ToString();
                            invalidText.IsVisible = true;
                        }
                    })
                    .Send();
                }
                else
                {
                    invalidText.Text      = "Password not match.";
                    invalidText.IsVisible = true;
                }
            }
            else
            {
                invalidText.Text      = "Fill all the required fields.";
                invalidText.IsVisible = true;
            }
        }
        else
        {
            invalidText.Text      = "Fill all the required fields.";
            invalidText.IsVisible = true;
        }
    }
Esempio n. 11
0
    public void Start()
    {
        if (CategoryConstant.GameType.Equals("fun"))
        {
            if (GameConstant.CurrentScore > GameConstant.FunHighScore)
            {
                //highScoreLable.Text = gameConsatant.currentScore.ToString();
                highScoreLable.Text = CategoryConstant.PrizeTopScore.ToString();
            }
            else
            {
                //highScoreLable.Text = gameConsatant.FunHighScore.ToString();
                highScoreLable.Text = CategoryConstant.PrizeTopScore.ToString();
            }
        }
        //Debug.Log("Score = "+gameConsatant.currentScore.ToString());

        //countObj.start ();
        if (catReply == null)
        {
            HTTP.Client.Instance.Configure(new HTTP.Settings(TriviaService.GetHostAddress()).Protocol(HTTP.Protocol.HTTP));

            new HTTP.Request(TriviaService.GetHttpFolderPath() + "get_questions.php?category_id=" + CategoryConstant.MainCategoryId + "&parent_id=" + CategoryConstant.SubCategoryId + "&grand_parant_id=" + CategoryConstant.GrandCategoryId)
            .OnReply(reply =>
            {
                catReply = JsonConvert.DeserializeObject <QuestionReply>(reply.DataAsString);

                if (catReply.success == 1)
                {
                    totalQuestion = catReply.data.Count;
                    StartRound();
                }
            })
            .Send();
        }
        else
        {
            StartRound();
        }


        //mainPanel.IsVisible = false;
        //StartCoroutine(Wait(2.0f));
        //Invoke( "LoadNewLevel", 5 );
    }
Esempio n. 12
0
    public void OnClick()
    {
        CategoryConstant.GameType = "fun";
        AudioSource backgroundClip = mainpanel.GetComponent <AudioSource>();

        GetComponent <AudioSource>().clip = clickBtn;
        GetComponent <AudioSource>().Play();

        if (!backgroundClip.isPlaying)
        {
            backgroundClip.Play();
            progress.Resume();
        }
        else
        {
            backgroundClip.Stop();
            progress.Stop();
            //  start game play

            if (CategoryConstant.GameType.Equals("fun"))
            {
                HTTP.Client.Instance.Configure(new HTTP.Settings(TriviaService.GetHostAddress()).Protocol(HTTP.Protocol.HTTP));

                new HTTP.Request(TriviaService.GetHttpFolderPath() + "get_player_fun_points.php?prize_id=" + CategoryConstant.PrizeId + "&th_cat_id=" + CategoryConstant.MainCategoryId + "&sec_cat_id=" + CategoryConstant.SubCategoryId + "&cat_id=" + CategoryConstant.GrandCategoryId + "&game_user_id=" + GameConstant.UserId + "&game_user_type=" + GameConstant.UserType)
                .OnReply((reply) => {
                    pointReply = JsonConvert.DeserializeObject <PointReply>(reply.DataAsString);

                    if (pointReply.success == 1)
                    {
                        GameConstant.FunHighScore = pointReply.points;
                    }
                    else
                    {
                        GameConstant.FunHighScore = 0;
                    }
                }).Send();
            }

            GameConstant.CurrentScore = 0;
            SceneManager.LoadScene("TriviaStratPlay");
        }
    }
Esempio n. 13
0
    void Start()
    {
        //  Grab user current daily game
        HTTP.Client.Instance.Configure(new HTTP.Settings(TriviaService.GetHostAddress()).Protocol(HTTP.Protocol.HTTP));
        new HTTP.Request(TriviaService.GetHttpFolderPath() + "get_player_game.php?game_user_id=" + GameConstant.UserId + "&game_user_type=" + GameConstant.UserType)
        .OnReply((reply2) => {
            DailyGameReply dailyReply = JsonConvert.DeserializeObject <DailyGameReply>(reply2.DataAsString);
            if (dailyReply.daily_game == 0)
            {
                SceneManager.LoadScene("TriviaInAppPurchase");
            }
        }).Send();


        notFoundPanel.IsVisible = false;
        dfScrollPanel categoryPanel = GetComponent <dfScrollPanel> ();

        //categoryPanel.Anchor = dfAnchorStyle.All;

        new HTTP.Request(TriviaService.GetHttpFolderPath() + "first_categories.php")
        .OnReply((reply) => {
            MainCatagoryReply catReply = JsonConvert.DeserializeObject <MainCatagoryReply>(reply.DataAsString);
            if (catReply.success == 1)
            {
                foreach (MainCatagoryData data in catReply.data)
                {
                    MainCatagory instance = categoryPanel.AddPrefab(Prefab.gameObject).GetComponent <MainCatagory>();
                    //instance.GetComponent<dfPanel>().Anchor = dfAnchorStyle.All;

                    instance.Data = data;
                    instance.start();
                }
                loaderPanel.IsVisible = false;
            }
            else
            {
                notFoundPanel.IsVisible = true;
                loaderPanel.IsVisible   = false;
            }
        })
        .Send();
    }
Esempio n. 14
0
    // Use this for initialization
    void Start()
    {
        correctanswer.Text    = "Correct Answers:       " + GameConstant.CorrectAnswerCount;
        difficultyanswer.Text = "Difficulty Bonus:       " + GameConstant.DifficultyAnswerCount;
        speedanswer.Text      = "Speed Bonus:       " + GameConstant.SpeedAnswerCount;
        pointscore.Text       = "Points Earned:       " + GameConstant.CurrentScore;

        //  insert score

        HTTP.Client.Instance.Configure(new HTTP.Settings(TriviaService.GetHostAddress()).Protocol(HTTP.Protocol.HTTP));

        new HTTP.Request(TriviaService.GetHttpFolderPath() + "add_game_score.php?game_user_id=" + GameConstant.UserId + "&game_user_type=" + GameConstant.UserType + "&game_points=" + GameConstant.CurrentScore + "&cat_id=" + CategoryConstant.GrandCategoryId + "&sec_cat_id=" + CategoryConstant.SubCategoryId + "&th_cat_id=" + CategoryConstant.MainCategoryId + "&prize_id=" + CategoryConstant.PrizeId)
        .OnReply((reply) => {
            AddScoreReply scoreReply = JsonConvert.DeserializeObject <AddScoreReply>(reply.DataAsString);
            if (scoreReply.success == 1)
            {
                //  Grab user current game Rank

                new HTTP.Request(TriviaService.GetHttpFolderPath() + "get_player_game_rank.php?game_user_id=" + GameConstant.UserId + "&game_user_type=" + GameConstant.UserType + "&cat_id=" + CategoryConstant.GrandCategoryId + "&sec_cat_id=" + CategoryConstant.SubCategoryId + "&th_cat_id=" + CategoryConstant.MainCategoryId + "&prize_id=" + CategoryConstant.PrizeId)
                .OnReply((reply1) => {
                    RankReply rankReply  = JsonConvert.DeserializeObject <RankReply>(reply1.DataAsString);
                    totalpointscore.Text = rankReply.points.ToString();
                    userplace.Text       = rankReply.rank.ToString() + "th Place";
                }).Send();

                //  Grab user current daily game

                new HTTP.Request(TriviaService.GetHttpFolderPath() + "get_player_game.php?game_user_id=" + GameConstant.UserId + "&game_user_type=" + GameConstant.UserType)
                .OnReply((reply2) => {
                    DailyGameReply dailyReply = JsonConvert.DeserializeObject <DailyGameReply>(reply2.DataAsString);
                    dailygame.Text            = dailyReply.daily_game.ToString();
                }).Send();
            }
        }).Send();

        GameConstant.CorrectAnswerCount    = 0;
        GameConstant.DifficultyAnswerCount = 0;
        GameConstant.SpeedAnswerCount      = 0;
        GameConstant.CurrentScore          = 0;
    }
Esempio n. 15
0
    public void OnClick()
    {
        GetComponent <AudioSource>().clip = clickBtn;
        GetComponent <AudioSource>().Play();
        if (GameConstant.IsSound == 1)
        {
            sound.Texture        = Resources.Load("music_icon_mute") as Texture2D;
            GameConstant.IsSound = 0;
        }
        else if (GameConstant.IsSound == 0)
        {
            sound.Texture        = Resources.Load("music_icon") as Texture2D;
            GameConstant.IsSound = 1;
        }

        HTTP.Client.Instance.Configure(new HTTP.Settings(TriviaService.GetHostAddress()).Protocol(HTTP.Protocol.HTTP));

        new HTTP.Request(TriviaService.GetHttpFolderPath() + "update_sound.php?user_id=" + GameConstant.UserId + "&issound=" + GameConstant.IsSound)
        .OnReply((reply) => {
        })
        .Send();
        //music.Texture = Resources.Load("alert_icon_mute") as Texture2D;
    }