Exemple #1
0
 public void SetPosition(int row, int col)
 {
     this.row = row;
     this.col = col;
     base.transform.localPosition = new Vector3((float)col * G3BoardGenerator.GetInstance().Cell_height + G3BoardGenerator.GetInstance().Cell_height / 2f - 400f
                                                , 400f - (float)row * G3BoardGenerator.GetInstance().Cell_width - G3BoardGenerator.GetInstance().Cell_width / 2f, 0f);
 }
    //return levels
    public void OnClickReturn(GameList obj)
    {
        int    arg     = Configs.TG00301[this.Model.Map_config.ID.ToString()].Level;
        Action action1 = delegate
        {
            G3BoardGenerator.GetInstance().DestroyMap();
            GlobalEventHandle.EmitDoRefreshCheckPoint(this.Model.Map_config.G003);
            GM.GetInstance().SetSavedGameID(0);
            GM.GetInstance().ResetToNewGame();
            GM.GetInstance().ResetConsumeCount();
            GlobalEventHandle.EmitDoGoHome();

            GlobalEventHandle.EmitClickPageButtonHandle("main", 0);
        };
        Action action2 = delegate
        {
            GM.GetInstance().SetSavedGameID(3);
            G3BoardGenerator.GetInstance().DestroyMap();
            G3BoardGenerator.GetInstance().StartNewGame(Configs.TG00301[this.Model.Map_config.ID.ToString()].ID);
        };
        Action action3;

        if ((action3 = G3BoardManager.CommonClass._action) == null)
        {
            action3 = (G3BoardManager.CommonClass._action = new Action(G3BoardManager.CommonClass._commonClass.OnClickReturn));
        }
        Utils.ShowPause(arg, action1, action2, action3).SetTitle("TXT_NO_10007");
    }
Exemple #3
0
    /*
     * set position for this block in the board
     */
    public void SetPosition(int index)
    {
        Debug.Log("index " + index);

        this.index = index;
        this.SetPosition(G3BoardGenerator.GetInstance().GetRow(index), G3BoardGenerator.GetInstance().GetCol(index));
    }
    private void Awake()
    {
        G3BoardManager.m_instance = this;

        //load board from level data
        this.Model = G3BoardGenerator.GetInstance();
        this.InitEvent();
    }
Exemple #5
0
    public void OnClickReturn()
    {
        if (GM.GetInstance().GameId == 0)
        {
            GlobalEventHandle.EmitDoGoHome();
            GlobalEventHandle.EmitClickPageButtonHandle("main", 0);
            return;
        }

        if (FindObjectOfType <Pause>() != null)
        {
            return;
        }

        switch (GM.GetInstance().GameId)
        {
        case 1:
        {
            Action <GameList> expr_36 = Game1DataLoader.GetInstance().OnClickReturnHandle;
            if (expr_36 == null)
            {
                return;
            }
            expr_36(this);
            return;
        }

        case 2:
        {
            Action <GameList> expr_4C = G2BoardGenerator.GetInstance().OnClickReturnHandle;
            if (expr_4C == null)
            {
                return;
            }
            expr_4C(this);
            return;
        }

        case 3:
        {
            Action <GameList> expr_62 = G3BoardGenerator.GetInstance().OnClickReturnHandle;
            if (expr_62 == null)
            {
                return;
            }
            expr_62(this);
            return;
        }

        default:
            return;
        }
    }
Exemple #6
0
    public void OnClickHome()
    {
        FireBaseManager.Instance.LogEvent("Puzzle_Line_Result_Main");
        AdsControl.Instance.ShowInterstitial();

        G3BoardGenerator.GetInstance().DestroyMap();
		GM.GetInstance().SetSavedGameID(0);
		GM.GetInstance().ResetToNewGame();
		GM.GetInstance().ResetConsumeCount();
		GlobalEventHandle.EmitClickPageButtonHandle("main", 0);
		GlobalEventHandle.EmitDoRefreshCheckPoint(this.Lv);
		DialogManager.GetInstance().Close(null);
	}
Exemple #7
0
	public void OnClickNext()
	{
        FireBaseManager.Instance.LogEvent("Puzzle_Line_Result_Next");

        UnityEngine.Debug.Log("On next lv");
		GM.GetInstance().SetSavedGameID(this.gameID);
        G3BoardGenerator.GetInstance().DestroyMap();
        G3BoardGenerator.GetInstance().StartNewGame(Configs.TG00301[this.Next.ToString()].ID);
		GlobalEventHandle.EmitDoRefreshCheckPoint(this.Lv);
		DialogManager.GetInstance().Close(null);

        AudioManager.GetInstance().PlayBgMusic("sound_ingame", true);

	}
Exemple #8
0
    public void Init(int idx, int int_color)
    {
        this.index = idx;
        this.color = int_color;
        this.SetPosition(idx);

        img_block.sprite = null;


        if (row % 2 == 0)
        {
            if (col % 2 == 0)
            {
                img_block.color = colors[0];
            }
            else
            {
                img_block.color = colors[1];
            }
        }
        else
        {
            if (col % 2 == 0)
            {
                img_block.color = colors[1];
            }
            else
            {
                img_block.color = colors[0];
            }
        }

        if (idx == 0)
        {
            img_block.sprite = Round[0];
        }
        else if (idx == G3BoardGenerator.GetInstance().m_map_row - 1)
        {
            img_block.sprite = Round[1];
        }
        else if (idx == (G3BoardGenerator.GetInstance().m_map_row *G3BoardGenerator.GetInstance().m_map_row) - G3BoardGenerator.GetInstance().m_map_row)
        {
            img_block.sprite = Round[2];
        }
        else if (idx == G3BoardGenerator.GetInstance().m_map_row *G3BoardGenerator.GetInstance().m_map_row - 1)
        {
            img_block.sprite = Round[3];
        }
    }
Exemple #9
0
 public void SetPosition(int index)
 {
     this.SetPosition(G3BoardGenerator.GetInstance().GetRow(index), G3BoardGenerator.GetInstance().GetCol(index));
 }
Exemple #10
0
    public void LoadGame(int id, int value = 0, bool isPageIn = true)
    {
        //this.PlayRecordAni();
        if (AdsManager.GetInstance().IsWatch)
        {
            //this.m_videoTimer.GetComponent<LanguageComponent>().SetText("TXT_NO_20018");
        }
        if (AdsManager.GetInstance().IsWatch)
        {
        }

        if (id == 0)
        {
            return;
        }
        foreach (KeyValuePair <int, GameObject> current in this.m_gameDict)
        {
            current.Value.SetActive(false);
        }
        if (this.m_gameDict.ContainsKey(id))
        {
            this.m_gameDict[id].SetActive(true);
            switch (id)
            {
            case 1:
                FireBaseManager.Instance.LogEvent("Puzzle_Mix_Start");
                Game1DataLoader.GetInstance().StartNewGame();
                break;

            case 2:
                FireBaseManager.Instance.LogEvent("2048_Start");
                G2BoardGenerator.GetInstance().StartNewGame();
                break;

            case 3:
                FireBaseManager.Instance.LogEvent("Puzzle_Line_Start");

                G3BoardGenerator.GetInstance().StartNewGame(value);
                break;
            }
        }
        else
        {
            Dictionary <int, string> dictionary = new Dictionary <int, string>
            {
                {
                    1,
                    "Prefabs/G001"
                },
                {
                    2,
                    "Prefabs/G002"
                },
                {
                    3,
                    "Prefabs/G00301"
                }
            };
            if (!dictionary.ContainsKey(id))
            {
                return;
            }
            GameObject gameObject = Resources.Load(dictionary[id]) as GameObject;
            gameObject = UnityEngine.Object.Instantiate <GameObject>(gameObject);
            gameObject.transform.SetParent(this.content.transform, false);
            if (id == 3 && value != 0)
            {
                G3BoardGenerator.GetInstance().StartNewGame(value);
            }
            this.m_gameDict.Add(id, gameObject);
        }
        if (isPageIn)
        {
            this.PlayGameIn();
        }
        //AppsflyerUtils.TrackPlayGame(id);
    }
Exemple #11
0
 private void Awake()
 {
     G3BoardGenerator.m_instance = this;
 }