コード例 #1
0
    //½ÃÀÛ
    public void StartNewGame(int idx = 30001)
    {
        this.Mask_isVictory = false;
        //°ÔÀÓ ¼¼À̺ê
        this.SaveGame(idx);
        //·¹º§º° ½ºÅ×ÀÌÁö Á¤º¸ °¡Á®¿À±â
        this.RelodConfig(idx);
        //¸Ê Á¤º¸ »ý¼º
        this.InitMap();
        //¸Ê Á¤º¸ °¡Á®¿À±â
        this.ReloadNodes();
        //Grid »ý¼º
        this.InitGrid();
        //¸Ê Á¤º¸·Î ºí·° »ý¼º
        this.DoReloadMapsHandle();

        id = idx;

        G3BoardManager.GetInstance().Set_Game(idx);

        if (idx == 30001)
        {
            //½ÃÀÛ °¡À̵å
            this.StartNoviceGuide(0);
            return;
        }

        this.StopNoviceGuide();
    }
コード例 #2
0
    private void LoadExpUI()
    {
        this.txt_lv.GetComponent <Text>().text = GM.GetInstance().Lv.ToString();
        if (Configs.TPlayers.ContainsKey(GM.GetInstance().Lv.ToString()))
        {
            TPlayer tPlayer = Configs.TPlayers[GM.GetInstance().Lv.ToString()];
            this.img_exp.GetComponent <Image>().fillAmount = (((float)GM.GetInstance().Exp / (float)tPlayer.Exp >= 1f) ? 1f : ((float)GM.GetInstance().Exp / (float)tPlayer.Exp));
        }

        Game2Manager.GetInstance()?.set_lv();
        Game1Manager.GetInstance()?.set_lv();
        G3BoardManager.GetInstance()?.set_lv();

        FindObjectOfType <G3BoardManager>()?.set_lv();
    }
コード例 #3
0
    public void Ads_Reward()
    {
        FireBaseManager.Instance.LogEvent("Reward_End");

        switch (reward_Type)
        {
        case Reward_Type.game1Finish:
            Debug.Log("첫번째 이어하기");
            FireBaseManager.Instance.LogEvent("Puzzle_Mix_Continue_Ads");

            GM.GetInstance().SetSavedGameID(GameID);
            Game1DataLoader.GetInstance().FillLife(false);
            Game1DataLoader.GetInstance().DoFillLife();
            DialogManager.GetInstance().Close(null);

            break;

        case Reward_Type.game2Finish:
            Debug.Log("두번째 이어하기");
            FireBaseManager.Instance.LogEvent("2048_Continue_Ads");

            GM.GetInstance().SetSavedGameID(GameID);
            DialogManager.GetInstance().Close(null);
            Game2Manager.GetInstance().video();

            break;

        case Reward_Type.again:

            break;

        case Reward_Type.block:

            Game1DataLoader.GetInstance().IsPlaying = true;
            Game1Manager.GetInstance().ControlPropsPannel(true);
            Game1Manager.GetInstance().UseProps(block);
            Game1Manager.GetInstance().m_markTips = true;

            break;

        case Reward_Type.skin:
            GM.GetInstance().SetSkinData(this.SkinID, 2);
            GM.GetInstance().SetSkinFreeTime(this.SkinID, DateTime.Now);
            //AppsflyerUtils.TrackBuySkin(this.SkinID, 1);
            Action <int> expr_38 = SkinUnLock.Instance.OnUnlockSuccess;
            if (expr_38 != null)
            {
                expr_38(this.SkinID);
            }
            DialogManager.GetInstance().Close(null);
            break;

        case Reward_Type.stimulate:

            int rans = UnityEngine.Random.Range(10, 100);
            GM.GetInstance().AddDiamond(rans);
            TaskData.GetInstance().Add(100105, 1, true);

            DateTime GiftTime = DateTime.Now.AddMinutes(10);
            DataManager.Instance.state_Player.LocalData_Main_Time = GiftTime.ToString();
            DataManager.Instance.Save_Player_Data();

            FindObjectOfType <MainScene>().Set_Timer();

            DotManager.GetInstance().CheckAds();

            break;

        case Reward_Type.Achive:

            if (!AchiveData.GetInstance().Finish(achive_type))
            {
                return;
            }

            GM.GetInstance().AddDiamond(achive_val * 2, true);
            FindObjectOfType <Achive>().Set_BindDataToUI();
            DialogManager.GetInstance().Close(null);

            break;

        case Reward_Type.Task:
            if (!TaskData.GetInstance().Finish(achive_type))
            {
                return;
            }

            GM.GetInstance().AddDiamond(achive_val * 2, true);
            FindObjectOfType <Task>().Refresh();
            DialogManager.GetInstance().Close(null);

            break;

        case Reward_Type.shop_ads:

            GiftTime = DateTime.Now.AddMinutes(10);
            DataManager.Instance.state_Player.LocalData_Shop_Time = GiftTime.ToString();
            DataManager.Instance.Save_Player_Data();

            FindObjectOfType <Shop>().ads_item.Set_Timer();

            int ran = UnityEngine.Random.Range(10, 100);
            GM.GetInstance().AddDiamond(ran);

            FireBaseManager.Instance.LogEvent("Shop_Ads");

            break;

        case Reward_Type.levelup:

            FindObjectOfType <LevelUp>().OnClickAds();


            break;

        case Reward_Type.stage:

            FindObjectOfType <G3WinDialog>().Reward();


            break;

        case Reward_Type.game:

            GiftTime = DateTime.Now.AddMinutes(10);
            DataManager.Instance.state_Player.LocalData_Game_Time = GiftTime.ToString();
            DataManager.Instance.Save_Player_Data();

            Game2Manager.GetInstance()?.Set_Timer();
            Game1Manager.GetInstance()?.Set_Timer();
            G3BoardManager.GetInstance()?.Set_Timer();

            ran = UnityEngine.Random.Range(10, 100);
            GM.GetInstance().AddDiamond(ran);

            break;

        case Reward_Type.coin:
            ran = UnityEngine.Random.Range(10, 100);
            GM.GetInstance().AddDiamond(ran);
            break;

        case Reward_Type.Daily:

            FindObjectOfType <Activity>().OnClickAds();


            break;

        case Reward_Type.gift:
            FindObjectOfType <RewardPopup>().Get_Gift();

            break;

        default:
            break;
        }
    }
コード例 #4
0
    public void Buy(Dictionary <string, object> data)
    {
        Debug.Log((int)data["shop_type"]);

        switch ((Shop_itme_type)(int)data["shop_type"])
        {
        case Shop_itme_type.ads:

            DataManager.Instance.state_Player.RemoveAds = true;
            transform.GetComponentsInChildren <ShopItem>(true)[0].gameObject.SetActive(false);
            AdsControl.Instance.BannerShow();
            break;

        case Shop_itme_type.package:

            FindObjectOfType <MainScene>().PlayPackageAni();

            for (int i = 0; i < 5; i++)
            {
                int item = (int)data["item_" + i];
                if (item == 0)
                {
                    continue;
                }


                switch ((Item_Type)i)
                {
                case Item_Type.Boom:
                    DataManager.Instance.state_Player.item_Localdata.Boom += item;
                    break;

                case Item_Type.Hammer:
                    DataManager.Instance.state_Player.item_Localdata.Hammer += item;
                    break;

                case Item_Type.Star:
                    DataManager.Instance.state_Player.item_Localdata.Star += item;
                    break;

                case Item_Type.Hint:
                    DataManager.Instance.state_Player.item_Localdata.Hint += item;
                    break;

                case Item_Type.coin:
                    GM.GetInstance().AddDiamond(item);

                    break;

                default:
                    break;
                }
            }

            GameObject obj = UnityEngine.Object.Instantiate <GameObject>(Resources.Load("Prefabs/shop_complet") as GameObject);
            obj.GetComponent <ShopComplete>().Set_Item(data);
            DialogManager.GetInstance().show(obj);


            break;

        case Shop_itme_type.gift:

            AdsControl.Instance.reward_Type = Reward_Type.shop_ads;

            AdsControl.Instance.ShowRewardedAd();


            break;

        case Shop_itme_type.gold:

            Debug.Log("골드~~ " + (int)data["item_4"]);

            GM.GetInstance().AddDiamond((int)data["item_4"]);


            break;

        case Shop_itme_type.item:

            if (DataManager.Instance.state_Player.LocalData_Diamond >= (int)data["price"])
            {
                GM.GetInstance().ConsumeGEM((int)data["price"]);

                for (int i = 0; i < 5; i++)
                {
                    int item = (int)data["item_" + i];

                    if (item == 0)
                    {
                        continue;
                    }

                    FindObjectOfType <MainScene>().PlayitemAni((Item_Type)i);



                    switch ((Item_Type)i)
                    {
                    case Item_Type.Boom:
                        FireBaseManager.Instance.LogEvent("Shop_bomb");

                        DataManager.Instance.state_Player.item_Localdata.Boom += item;
                        break;

                    case Item_Type.Hammer:
                        FireBaseManager.Instance.LogEvent("Shop_cross_hammer");

                        DataManager.Instance.state_Player.item_Localdata.Hammer += item;
                        break;

                    case Item_Type.Star:
                        FireBaseManager.Instance.LogEvent("Shop_color_star");

                        DataManager.Instance.state_Player.item_Localdata.Star += item;
                        break;

                    case Item_Type.Hint:
                        FireBaseManager.Instance.LogEvent("Shop_magnigier");

                        DataManager.Instance.state_Player.item_Localdata.Hint += item;
                        break;

                    case Item_Type.coin:

                        GM.GetInstance().AddDiamond(item);

                        break;

                    default:
                        break;
                    }
                }

                obj = UnityEngine.Object.Instantiate <GameObject>(Resources.Load("Prefabs/shop_complet") as GameObject);
                obj.GetComponent <ShopComplete>().Set_Item(data);
                DialogManager.GetInstance().show(obj);
            }



            break;

        default:
            break;
        }


        Game1Manager.GetInstance()?.Set_Txt_Item();
        G3BoardManager.GetInstance()?.Set_Item_Txt();
        DataManager.Instance.Save_Player_Data();

#if UNITY_ANDROID
        GoogleManager.Instance.isPopup = false;
        GoogleManager.Instance.Player_Data_Save();
#elif UNITY_IOS
        string jsonStr = JsonUtility.ToJson(DataManager.Instance.state_Player);
        string aes     = AESCrypto.AESEncrypt128(jsonStr);

        CloudVariables.Player_Data = aes;

        Cloud.Storage.Save();
#endif
    }
コード例 #5
0
    public int CheckDropPos(int click, Vector2 pos)
    {
        if (pos.x <= -400f || pos.x >= 400f || pos.y >= 400f || pos.y <= -400f)
        {
            return(-1);
        }

        bool       flag           = false;
        Vector2    mousePosRowCol = this.GetMousePosRowCol(pos);
        int        index          = this.GetIndex((int)mousePosRowCol.x, (int)mousePosRowCol.y);
        Color_Node headQueue      = this.GetHeadQueue(this.GetNode(click));
        Color_Node color_Node     = this.GetEndQueue(this.GetNode(click));

        if (color_Node.Index == index)
        {
            return(-1);
        }
        if (headQueue.Index != color_Node.Index && headQueue.Color == color_Node.Color && color_Node.Type == G3BoardGenerator.Node_type.TARGET)
        {
            return(-1);
        }
        if (this.mask_isInGuide != -1 && !this.HandelGuideClick(index))
        {
            return(-1);
        }
        List <int> pathNode = this.GetPathNode(color_Node.Index, index);

        if (pathNode.Count > 0 && this.GetNode(index).Type == G3BoardGenerator.Node_type.TARGET && color_Node.Color != this.GetNode(index).Color)
        {
            pathNode.RemoveAt(pathNode.Count - 1);
        }
        if (pathNode.Count > 0)
        {
            pathNode.RemoveAt(0);
        }

        Color_Node color_Node2 = null;

        foreach (int current in pathNode)
        {
            if (flag)
            {
                click = color_Node2.Index;
            }

            headQueue   = this.GetHeadQueue(this.GetNode(click));
            color_Node  = this.GetEndQueue(this.GetNode(click));
            color_Node2 = this.GetNode(current);

            //³ëµå üũ
            if (color_Node2 != null)
            {
                switch (color_Node2.Type)
                {
                case G3BoardGenerator.Node_type.NONE:
                    Debug.Log("¾øÀ»‹š");
                    color_Node.Next   = color_Node2.Index;
                    color_Node2.Per   = color_Node.Index;
                    color_Node2.Color = color_Node.Color;
                    color_Node2.Type  = G3BoardGenerator.Node_type.SEGMENT;
                    this.DoAddBlockHandle(color_Node2.Index);
                    break;

                case G3BoardGenerator.Node_type.TARGET:
                    if (color_Node.Color == color_Node2.Color && headQueue.Index != color_Node2.Index)
                    {
                        color_Node.Next = color_Node2.Index;
                        color_Node2.Per = color_Node.Index;
                        this.DoAddBlockHandle(color_Node2.Index);
                        if (this.mask_isInGuide != -1)
                        {
                            this.StartNoviceGuide(this.mask_isInGuide + 1);
                        }
                        this.CheckIsVictory();
                    }
                    break;

                case G3BoardGenerator.Node_type.SEGMENT:
                    //¹è±³ ³»²¨
                    Debug.Log("ÀÖÀ»¶§");
                    Debug.Log(color_Node2.Index + "   +   " + color_Node.Index);
                    Debug.Log(color_Node2.Color + "   +   " + color_Node.Color);

                    if (color_Node2.Color == color_Node.Color)
                    {
                        flag = true;
                        while (color_Node2.Index != color_Node.Index)
                        {
                            int per = color_Node.Per;
                            this.ResetNode(color_Node);
                            this.DoRemoveBlockHandle(color_Node.Index);
                            color_Node = this.GetNode(per);
                        }
                        color_Node2.Next = color_Node2.Index;
                    }
                    else
                    {
                        G3BoardManager.GetInstance().Change_Color(color_Node2.Index, color_Node.Color);
                        Color_Node expr_24E = this.GetNode(color_Node2.Per);
                        expr_24E.Next = expr_24E.Index;
                        this.CleanRestColor(color_Node2);
                        color_Node.Next   = color_Node2.Index;
                        color_Node2.Per   = color_Node.Index;
                        color_Node2.Color = color_Node.Color;
                    }
                    break;
                }
            }
        }
        this.DoRefreshHandle();
        this.mask_click = false;
        if (flag)
        {
            return(color_Node2.Index);
        }
        return(-1);
    }