public void Show(StaticLevel dataStaticLevel, CallbackYes callbackYes, CallbackNo callbackNo)
    {
        UserStockData.Load();

        this.dataStaticLevel = dataStaticLevel;

        WhiteBubbleStock  = UserStockData.WhiteBubbleStock;
        RedBubbleStock    = UserStockData.RedBubbleStock;
        OrangeBubbleStock = UserStockData.OrangeBubbleStock;

        TextWhiteBubble.text  = WhiteBubbleStock.ToString();
        TextRedBubble.text    = RedBubbleStock.ToString();
        TextOrangeBubble.text = OrangeBubbleStock.ToString();

        this.callbackYes = callbackYes;
        this.callbackNo  = callbackNo;
        GetComponent <Animator>().SetTrigger("Show");
        isShowing = true;

        MaksBubble = dataStaticLevel.Bubbles.Count;
        for (int i = 0; i < MaksBubble; i++)
        {
            GameObject objek = (GameObject)Instantiate(UndefineBubble);
            objek.transform.SetParent(PanelPreview.transform);
            objek.transform.localScale    = new Vector3(1, 1, 1);
            objek.transform.localPosition = new Vector3(objek.transform.localPosition.x, objek.transform.localPosition.y, 0);
            objek.GetComponent <DropBubbleHandler>().reloadPopupController = this;
            objek.GetComponent <ItemGelembungController>().Define          = false;
        }

        WhiteBubbleButton.SetActive(!(WhiteBubbleStock == 0));
        RedBubbleButton.SetActive(!(RedBubbleStock == 0));
        OrangeBubbleButton.SetActive(!(OrangeBubbleStock == 0));
    }
Пример #2
0
    public void SubmitPostPlay(StaticLevel dataLevel, int WhiteBubbleBonus, int RedBubbleBonus, int OrangBubbleBonus, int GoldBonus, string StatusPostPlay)
    {
        if (dataLevel.HighScore < EntityManager.Load <int>("cache_" + dataLevel.Place + "_" + dataLevel.Level.ToString()))
        {
            dataLevel.HighScore = EntityManager.Load <int>("cache_" + dataLevel.Place + "_" + dataLevel.Level.ToString());
        }

        if (FB.IsLoggedIn)
        {
            WWWForm wwwForm = new WWWForm();
            wwwForm.AddField("app_token", UserDataManager.APP_TOKEN);
            wwwForm.AddField("facebook_id", FB.UserId);
            wwwForm.AddField("white_bubble", WhiteBubbleBonus);
            wwwForm.AddField("red_bubble", RedBubbleBonus);
            wwwForm.AddField("orange_bubble", OrangBubbleBonus);
            wwwForm.AddField("gold", GoldBonus);
            wwwForm.AddField("level", ((StaticLevel)dataLevel).Place + "_" + ((StaticLevel)dataLevel).Level.ToString()); /// parbaba_1
            wwwForm.AddField("score", dataLevel.HighScore);
            wwwForm.AddField("status", StatusPostPlay);

            WWW www = new WWW(UserDataManager.URL_SUBMIT_ONCE_PLAY, wwwForm);

            StartCoroutine(DoRequestPostPlay(www, dataLevel));
        }
        else
        {
            EntityManager.Save <int>("cache_" + dataLevel.Place + "_" + dataLevel.Level.ToString(), dataLevel.HighScore);
            UserDataManager.LevelScores[dataLevel.Place + "_" + dataLevel.Level.ToString()] = dataLevel.HighScore;
        }
    }
Пример #3
0
 public void Show(Level level)
 {
     loadingMessage.SetActive(false);
     MessageNotValid.SetActive(false);
     dataStaticLevel = null;
     dataLevel       = level;
     fieldName.text  = dataLevel.Name;
     RefreshBubble(dataLevel.Bubbles);
     GetComponent <Animator>().SetTrigger("Show");
 }
Пример #4
0
    private IEnumerator DoRequestPostPlay(WWW www, StaticLevel dataLevel)
    {
        yield return(www);

        if (www.error != null)
        {
            UserDataManager.LevelScores[(((StaticLevel)dataLevel).Place + "_" + ((StaticLevel)dataLevel).Level.ToString())] = dataLevel.HighScore;
            EntityManager.Save <int>("cache_" + dataLevel.Place + "_" + dataLevel.Level.ToString(), dataLevel.HighScore);
        }
    }
Пример #5
0
    /*
     * public void Show(Level dataLevel, ChooseBubbleCallback callback)
     * {
     *  this.dataLevel = dataLevel;
     *  RefreshBubble(dataLevel.Bubbles);
     *  GetComponent<Animator>().SetTrigger("Show");
     *  this.callback = callback;
     *  isShowing = true;
     * }
     * */

    public void Show(StaticLevel dataLevel, ChooseBubbleCallback callback)
    {
        this.dataLevel      = dataLevel;
        this.WhiteQuantity  = dataLevel.WhiteQuantity;
        this.RedQuantity    = dataLevel.RedQuantity;
        this.OrangeQuantity = dataLevel.OrangeQuantity;
        RefreshBubble(dataLevel.Bubbles);
        GetComponent <Animator>().SetTrigger("Show");
        this.callback = callback;
        isShowing     = true;
    }
Пример #6
0
    private void ReadLevel()
    {
        if (dataRecieveds.Count > 0)
        {
            if (dataRecieveds[0].Sender == SceneName.LevelEditorCreate || ((dataRecieveds[0].Sender == SceneName.PlayParbaba || dataRecieveds[0].Sender == SceneName.PlayBatuguru || dataRecieveds[0].Sender == SceneName.PlayParapat || dataRecieveds[0].Sender == SceneName.PlayTomok) && Mode == GameplayMode.ValidateLevel))
            {
                Mode      = GameplayMode.ValidateLevel;
                dataLevel = (Level)dataRecieveds[0].Data;
                if (!dataLevel.HasUndefineBubble())
                {
                    RefreshLevel(dataLevel);
                }
                else
                {
                    chooseBubbleController.Show(dataStaticLevel, RefreshBubble);
                    State = GameplayState.ChooseBubble;
                    //RefreshBackground(dataLevel.Place);
                    RefreshRubbish(dataLevel.Rubbishes);
                    RefreshBarrier(dataLevel.Barriers);
                }
            }
            else if (dataRecieveds[0].Sender == SceneName.LevelEditorCreate || ((dataRecieveds[0].Sender == SceneName.PlayParbaba || dataRecieveds[0].Sender == SceneName.PlayBatuguru || dataRecieveds[0].Sender == SceneName.PlayParapat || dataRecieveds[0].Sender == SceneName.PlayTomok) && Mode == GameplayMode.Edited))
            {
                Mode = GameplayMode.Edited;
            }
            else if ((dataRecieveds[0].Sender == SceneName.ChooseLevelParbaba || dataRecieveds[0].Sender == SceneName.ChooseLevelBatuguru || dataRecieveds[0].Sender == SceneName.ChooseLevelParapat || dataRecieveds[0].Sender == SceneName.ChooseLevelTomok) || ((dataRecieveds[0].Sender == SceneName.PlayParbaba || dataRecieveds[0].Sender == SceneName.PlayBatuguru || dataRecieveds[0].Sender == SceneName.PlayParapat || dataRecieveds[0].Sender == SceneName.PlayTomok) && Mode == GameplayMode.StaticLevel))
            {
                Mode            = GameplayMode.StaticLevel;
                dataStaticLevel = (StaticLevel)dataRecieveds[0].Data;
                if (!dataStaticLevel.HasUndefineBubble())
                {
                    RefreshLevel(dataStaticLevel);
                }
                else
                {
                    BtnShoot.SetActive(false);
                    chooseBubbleController.Show(dataStaticLevel, RefreshBubble);
                    //RefreshBackground(dataStaticLevel.Place);
                    RefreshRubbish(dataStaticLevel.Rubbishes);
                    RefreshBarrier(dataStaticLevel.Barriers);
                    State = GameplayState.ChooseBubble;

                    /*if (dataStaticLevel.HighScore==0 && dataStaticLevel.Place == "Batuguru" && dataStaticLevel.Level == 11)
                     * {
                     *      tutorialPora.SetTrigger("define");
                     *      closeForDefine.SetActive(true);
                     *      tutorialAnimator.SetTrigger("Show");
                     * }*/
                }
            }
        }
    }
Пример #7
0
        private void AddLevelToSpacings(Level.LevelType levelType, float difficulty, ref int nextLineUniqueId)
        {
            StaticLevel level      = (StaticLevel)levelsKinds[(int)levelType];
            int         linesCount = level.GetTreesLinesCount(difficulty);
            float       spacing    = level.GetTreeSpacing(difficulty);

            for (int i = 0; i < linesCount && nextLineUniqueId < spacings.Length; i++)
            {
                spacings[nextLineUniqueId] = spacing;
                nextLineUniqueId++;
            }
            ednOfPrevLevel += spacing * linesCount;
        }
Пример #8
0
    public void Show(StaticLevel dataLevel)
    {
        leaderboard.Show(dataLevel);

        UserStockData.Load();
        this.dataLevel = dataLevel;
        RefreshLevel(dataLevel);
        animator.SetTrigger("Show");
        //GetComponent<LeaderboardManager>().Show(dataLevel);
        MyPublicHightScore.text = dataLevel.HighScore.ToString("#,0");
        MyFriendHightScore.text = dataLevel.HighScore.ToString("#,0");

        LevelName.text = "Level " + dataLevel.Level;
    }
Пример #9
0
    public void Show(string season, string place, int level)
    {
        UserStockData.Load();
        this.dataLevel = new StaticLevel(season, place, level);

        leaderboard.Show(dataLevel);

        RefreshLevel(dataLevel);
        animator.SetTrigger("Show");
        //GetComponent<LeaderboardManager>().Show((StaticLevel)dataLevel);
        MyPublicHightScore.text = dataLevel.HighScore.ToString("#,0");
        MyFriendHightScore.text = dataLevel.HighScore.ToString("#,0");

        LevelName.text = "Level " + dataLevel.Level;
    }
Пример #10
0
    public StaticLevel(string Season, string Place, int level)
        : base(EntityManager.XMLToInstance <StaticLevel>(Resources.Load <TextAsset>(Season + "/" + Place + "/" + level.ToString()).text))
    {
        this.Season = Season;
        this.Place  = Place;
        this.Level  = level;
        StaticLevel temp = EntityManager.XMLToInstance <StaticLevel>(Resources.Load <TextAsset>(Season + "/" + Place + "/" + level.ToString()).text);

        this.WhiteQuantity  = temp.WhiteQuantity;
        this.RedQuantity    = temp.RedQuantity;
        this.OrangeQuantity = temp.OrangeQuantity;

        UserScoreData userScore = UserScoreData.Load();

        this.HighScore = userScore.GetScore(Place, Level);
    }
//	private  Dictionary<int, int> dict = new  Dictionary<int, int>();
	public static StaticLevel Instance()
	{
        if(_instance == null)
        {
            lock(lockHelper)
            {
                if(_instance == null)
				{
                     _instance = new StaticLevel();
//#if UNITY_EDITOR
                     _instance.readData();
//#endif
                }
            }
        }
        return _instance;
    }
Пример #12
0
    public void Show(StaticLevel level)
    {
        loadingMessage.SetActive(false);
        MessageNotValid.SetActive(false);
        dataLevel       = null;
        dataStaticLevel = level;
        fieldName.text  = dataStaticLevel.Name;
        RefreshBubble(dataStaticLevel.Bubbles);
        GetComponent <Animator>().SetTrigger("Show");
        QuantityText.White.text  = dataStaticLevel.WhiteQuantity.ToString();
        QuantityText.White.text  = dataStaticLevel.WhiteQuantity.ToString();
        QuantityText.Orange.text = dataStaticLevel.OrangeQuantity.ToString();

        StarScoreField.Star1.text = dataStaticLevel.ScoreFor1Star.ToString();
        StarScoreField.Star2.text = dataStaticLevel.ScoreFor2Star.ToString();
        StarScoreField.Star3.text = dataStaticLevel.ScoreFor3Star.ToString();
    }
Пример #13
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        StaticLevel level = (StaticLevel)target;

        if (GUILayout.Button("\nTOGGLE RENDERERS\n"))
        {
            // flip
            level.renderersVisible = !level.renderersVisible;

            // toggle renderers
            Renderer[] renderers = level.gameObject.GetComponentsInChildren <Renderer>();
            foreach (Renderer renderer in renderers)
            {
                renderer.enabled = level.renderersVisible;
            }

            // set dirty
            EditorUtility.SetDirty(level);
            EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
        }
    }
Пример #14
0
    public void Refresh()
    {
        dataLevel = new StaticLevel(Season, Place, Level);

        UserScoreData userScoreData = UserScoreData.Load();

        if (RequiredLevel < 1)
        {
            RequiredLevel = 1;
        }
        if (userScoreData.GetScore(RequiredPlace, RequiredLevel) > 0 || (Place == "Parbaba" && Level == 1) || canPlay)
        {
            canPlay = true;
            Image imageComponent = GetComponent <Image>();
            imageComponent.sprite = FinishedSprite;
        }
        if (dataLevel.HighScore > 0)
        {
            HideRubbishes();
        }
        ShowStar();
    }
Пример #15
0
    public void Show(StaticLevel dataLevel)
    {
        CountRequsetGlobal = 1;
        CountRequestFriend = 1;

        ConnectButton.SetActive(false);
        if (dataStaticLevel == null || dataStaticLevel.GlobalId != dataLevel.GlobalId || !LastStatus)
        {
            this.dataStaticLevel = dataLevel;
            if (FB.IsLoggedIn)
            {
                for (int i = 0; i < PanelItemFriend.transform.childCount; i++)
                {
                    Destroy(PanelItemFriend.transform.GetChild(i).gameObject);
                }
                for (int i = 0; i < PanelItemGlobal.transform.childCount; i++)
                {
                    Destroy(PanelItemGlobal.transform.GetChild(i).gameObject);
                }

                OwnGlobalItem.GetComponent <ItemLeaderboard>().Init(0, "You", dataLevel.HighScore, "", "", "");
                OwnFriendItem.GetComponent <ItemLeaderboard>().Init(0, "You", dataLevel.HighScore, "", "", "");

                LoadingPopupFriend.SetActive(true);
                LoadingPopupGlobal.SetActive(true);
                StartCoroutine("RefreshFriend");
                StartCoroutine("RefreshGlobal");
            }
            else
            {
                OwnGlobalItem.GetComponent <ItemLeaderboard>().Init(0, "You", dataLevel.HighScore, "", "", "");
                OwnFriendItem.GetComponent <ItemLeaderboard>().Init(0, "You", dataLevel.HighScore, "", "", "");
                LoadingPopupFriend.SetActive(false);
                LoadingPopupGlobal.SetActive(false);
                ConnectButton.SetActive(true);
            }
        }
    }
Пример #16
0
 public void InitDataLevel(StaticLevel dataLevelStatic)
 {
     this.dataLevelStatic = dataLevelStatic;
     CountRequestConnect  = 1;
     CheckClue();
 }
Пример #17
0
 public StaticLevel(StaticLevel level)
     : base(level)
 {
 }