Пример #1
0
 public void ClickUnlock()
 {
     Debug.Log("解锁");
     XPlayerPrefs.SetInt(levelID.ToString() + isUnlock, -1);
     XPlayerPrefs.Save();
     Destroy(transform.Find("unlockBtn").gameObject);
 }
    //スイッチ選択ダイアログのコールバックハンドラ
    private void ReceiveSwitches(string message)
    {
#if UNITY_EDITOR
        Debug.Log("ReceiveSwitches : message = " + message);
#endif
        ShowToast(message);

        XDebug.Clear(); //※ヒエラルキーにある「DebugConsole」をオンにすると内容が見れます。
        XDebug.Log("(ReceiveSwitches : message)");
        XDebug.Log(message, 3);

        string   str = "";
        string[] arr = message.Split('\n');
        for (int i = 0; i < arr.Length; i++)
        {
            switchChecks[i] = arr[i].EndsWith("true");
            if (switchChecks[i])
            {
                str += switchItems[i] + "がドSになりました!\n";
            }
        }

        XPlayerPrefs.SetArray(gameObject.name + SWITCH_PREF, switchChecks); //配列で保存
        StartCoroutine(DelayedToast(str.Trim(), 3));                        //少し遅れてトースト表示
    }
Пример #3
0
    private static void PassAllStage_Func(object[] objs)
    {
        Debug.Log("pass");
        //string numAllStar = "numAllStar";
        string isUnlock    = "isUnlock";
        string isCompleted = "isCompleted";
        //string numStar = "numStar";
        LevelConfig_ARRAY m_config = LevelMgr.GetInstance().GetLevelConfigArray();

        for (int i = 0; i < m_config.Items.Count; i++)
        {
            string id = m_config.Items[i].LevelId.ToString();

            //设置关卡解锁状态
            XPlayerPrefs.SetInt(id + isUnlock, -1);
            XPlayerPrefs.SetInt(id + isCompleted, 1);

            ////设置当前关卡星星
            //int preStar = XPlayerPrefs.GetInt(id + numStar);
            //XPlayerPrefs.SetInt(id + numStar, 3);

            ////设置总星星数量
            //int curNum = XPlayerPrefs.GetInt(numAllStar);
            //XPlayerPrefs.SetInt(numAllStar, curNum + 3 - preStar);
        }
        //保存
        XPlayerPrefs.Save();
    }
    //Android Switch Dialog -> Callback handler
    private void ReceiveSwitches(string message)
    {
#if UNITY_EDITOR
        Debug.Log("ReceiveSwitches : message = " + message);
#endif
        ShowToast(message);

        //(*) Activate the "DebugConsole" in the hierarchy to see its parameters.
        XDebug.Clear();
        XDebug.Log("(ReceiveSwitches : message)");
        XDebug.Log(message, 3);

        string   str = "";
        string[] arr = message.Split('\n');
        for (int i = 0; i < arr.Length; i++)
        {
            switchChecks[i] = arr[i].EndsWith("true");
            if (switchChecks[i])
            {
                str += switchItems[i] + " entered the party.\n";
            }
        }

        XPlayerPrefs.SetArray(gameObject.name + SWITCH_PREF, switchChecks); //Save array values (PlayerPrefs)
        StartCoroutine(DelayedToast(str.Trim(), 3));                        //Show Android Toast with delay
    }
Пример #5
0
    public bool IsSign(int DayInt)
    {
        int index  = DayInt / 8;
        int offset = DayInt % 8;

        return(XPlayerPrefs.GetSign(index, offset));
    }
Пример #6
0
    IEnumerator Guiding()
    {
        yield return(new WaitForSeconds(0.15f));

        if (needMask == 1)
        {
            Debug.Log("init");
            mask.SetActive(true);
            shaderViewer.Init(1, 0);
        }
        if (needMask == 2)
        {
            var rec = XPlayerPrefs.GetRec(levelID);
            if (rec == null)
            {
                SettlePuzzle newSettlePuzzle = new SettlePuzzle();
                newSettlePuzzle.puzzleID          = 0;
                newSettlePuzzle.puzzleRotateState = 0;
                newSettlePuzzle.puzzleGridIndex   = 127;
                generalPanelUI.SettlePuzzleFunc(newSettlePuzzle);
                Debug.Log("init");
                mask.SetActive(true);
                shaderViewer.Init(2, 0);
            }
        }
    }
Пример #7
0
    public override void OnExit(params object[] argv)
    {
        GameObject nextLevelButton = argv[0] as GameObject;

        nextLevelButton.SetActive(false);
        int selectedDateTimeInt = XPlayerPrefs.GetInt(ChallengeController.selectedDateTimeStr);

        Debug.Log("sign:" + (selectedDateTimeInt - GameConfig.SignInDay).ToString());
        SignInMgr.GetInstance().Sign(selectedDateTimeInt - GameConfig.SignInDay);
    }
Пример #8
0
 public int GetNumOfComplete()
 {
     for (int i = 0; i < m_config.Items.Count; i++)
     {
         if (XPlayerPrefs.GetInt(m_config.Items[i].LevelId.ToString() + "isCompleted") == 0)
         {
             return(i);
         }
     }
     return(m_config.Items.Count);
 }
Пример #9
0
    public void OnShow()
    {
        if (gameObject.name == "UIEnd(Clone)")
        {
            LoadOriginImg();
            SetToNextLevel();

            //保存
            XPlayerPrefs.Save();
        }
    }
Пример #10
0
    public void Sign(int DayInt)
    {
        Debug.Log("DayInt:" + DayInt);



        int index  = DayInt / 8;
        int offset = DayInt % 8;

        Debug.Log("index:" + index);
        Debug.Log("offset:" + offset);

        XPlayerPrefs.SetSign(index, offset, 1);
    }
Пример #11
0
 public void LevelRestartCorou()
 {
     if (buttonCheck)
     {
         buttonCheck = false;
         //Debug.Log("restart");
         // Resume();
         uint curLevelID = LevelMgr.GetInstance().CurLevelID;
         XPlayerPrefs.DelRec(curLevelID);
         // pausePage.SetActive(false);
         CloseUIPlay();
         UIMgr.GetInstance().ShowPage_Play(UIPageEnum.Play_Page);
     }
 }
Пример #12
0
 public void SetLevelId(uint levelId, bool isregen = false)
 {
     //判断当前关卡有没有存档
     if (isregen)
     {
         Recorder rec = XPlayerPrefs.GetRec(levelId);
         m_recoder = rec;
     }
     else
     {
         m_recoder         = new Recorder();
         m_recoder.LevelId = levelId;
     }
 }
Пример #13
0
    private void FixedUpdate()
    {
        if (isShadow)
        {
            scrollbar.value = scrollValue;
            if (shadows[type].localScale != shadowMax)
            {
                shadows[type].localScale = Vector3.Lerp(shadows[type].localScale, shadowMax, Time.deltaTime * shadowSpeed);
                if (Mathf.Abs(shadows[type].localScale.x - shadowMax.x) <= 10.0f)
                {
                    shadows[type].localScale = Vector3.zero;
                    XPlayerPrefs.SetInt(shadowType, -1);
                    isShadow = false;
                }
            }
        }
        if (isShadowToLevel)
        {
            if (shadows[type].localScale != shadowMin)
            {
                shadows[type].localScale = Vector3.Lerp(shadows[type].localScale, shadowMin, Time.deltaTime * shadowSpeedToMain);

                if (Mathf.Abs(shadows[type].localScale.x - shadowMin.x) <= 0.1f)
                {
                    shadows[type].localScale = Vector3.zero;
                    //进入主界面
                    isShadowToLevel = false;
                    black.alpha     = 1.0f;
                    UIMgr.GetInstance().ShowPage_Play(UIPageEnum.Play_Page);
                }
            }
        }
        if (isShadowToMain)
        {
            if (shadows[type].localScale != shadowMin)
            {
                shadows[type].localScale = Vector3.Lerp(shadows[type].localScale, shadowMin, Time.deltaTime * shadowSpeedToMain);

                if (Mathf.Abs(shadows[type].localScale.x - shadowMin.x) <= 0.1f)
                {
                    shadows[type].localScale = Vector3.zero;
                    //进入主界面
                    isShadowToMain = false;
                    black.alpha    = 1.0f;
                    UIMgr.GetInstance().ShowPage(UIPageEnum.Main_Page);
                }
            }
        }
    }
Пример #14
0
 private void OnApplicationPause(bool pause)
 {
     if (pause)
     {
         m_last_timestamp = Time.time;
     }
     else
     {
         if (Time.time - m_last_timestamp >= Time_Interval)
         {
             int count = XPlayerPrefs.GetInt(StartUpCount_Tag) + 1;
             XPlayerPrefs.SetInt(StartUpCount_Tag, count);
         }
     }
 }
Пример #15
0
    private void SaveOperation()
    {
        Recorder rec = operationHistoryRecorder.Recoder;

        rec.LevelId = levelID;
        rec.layout  = MatrixUtil.ArrayCopy(generalPanelUI.generalPanelData.Playout);
        // rec.TimeCount = levelTimer.Time;
        if (!rec.isFilled())
        {
            XPlayerPrefs.DelRec(rec.LevelId);
            return;
        }
        //todo 保存广告格子的个数
        XPlayerPrefs.SetRec(rec);
    }
Пример #16
0
    private void Start()
    {
        InitUI();

        //TODO:修改选择,上方界面的显示和下方界面的显示
        // 从主界面-每日挑战 默认选择最新一关
        // 每日结算界面-每日挑战 默认选当前关
        //重置选择:
        XPlayerPrefs.SetInt(selectedDateTimeStr, 0);

        calendarPanel.InitPanelSize();
        calendarPanel.InitAllCalendars();

        initFlag = true;
    }
Пример #17
0
    public bool CheckOver()
    {
        foreach (int i in playout)
        {
            if (i == (int)GridType.Blank)
            {
                return(false);
            }
        }
        uint curLevelID = LevelMgr.GetInstance().CurLevelID;

        XPlayerPrefs.DelRec(curLevelID);
        SDKMgr.GetInstance().Track(SDKMsgType.OnLevelClear, (int)curLevelID);
        return(true);
    }
Пример #18
0
 private void ShadowInit()
 {
     //随机加载阴影图
     type = Random.Range(0, 3);
     //type = 1;
     XPlayerPrefs.SetInt(shadowType, type);
     for (int i = 0; i < shadows.Length; i++)
     {
         shadows[i].localScale = Vector3.zero;
     }
     if (type != -1)
     {
         shadows[type].localScale = shadowMax;
     }
     isShadow = false;
 }
Пример #19
0
    IEnumerator ShadowInit2()
    {
        type = XPlayerPrefs.GetInt(shadowType);
        int waittime = (type == -1) ? 0 : 1;

        black.alpha = 1.0f;
        yield return(new WaitForSeconds(0.2f * waittime));

        black.alpha = 0.0f;
        if (type != -1)
        {
            shadows[type].localScale = shadowMin;
        }
        yield return(new WaitForSeconds(0.02f * waittime));

        isShadowFromList = true;
    }
    const string SWITCH_PREF = "_switches";     //PlayerPrefs 保存用

    //スイッチ選択ダイアログ
    public void TestDialogSwitch()
    {
        if (switchChecks == null)                                                                              //保存されているものがあれば読み込む(無ければ全オフで新規生成)
        {
            switchChecks = XPlayerPrefs.GetArray(gameObject.name + SWITCH_PREF, new bool[switchItems.Length]); //※配列は保存されている長さになるので注意
        }
        XDebug.Clear();                                                                                        //※ヒエラルキーにある「DebugConsole」をオンにすると内容が見れます。
        XDebug.Log("(PlayerPrefs or init)");
        XDebug.Log(switchChecks.Select(e => e.ToString()).Aggregate((s, a) => s + ", " + a), 3);

#if UNITY_EDITOR
        Debug.Log("TestDialogSwitch called");
#elif UNITY_ANDROID
        string[] keys = (switchKeyToggle != null && !switchKeyToggle.isOn) ? null : switchKeys;
        AndroidPlugin.ShowSwitchDialog("嫁のブレンド・S 設定", "ドSのオン・オフができます。", switchItems, keys, switchChecks, 0, gameObject.name, "ReceiveSwitches", "これでいい", "やめる");
#endif
    }
Пример #21
0
    private void OnPayRemoveAD(JsonData data)
    {
        int retcode = (int)data["Ret"];

        if (retcode == 1)
        {
#if UNITY_EDITOR
            //UIMgr.GetInstance().ShowSimpleTips("购买去广告服务成功");
#endif
            XPlayerPrefs.SetInt(AdMgr.Pay2RemoveAD_Tag, 1);
        }
        else
        {
            XPlayerPrefs.SetInt(AdMgr.Pay2RemoveAD_Tag, 0);
        }
        AdMgr.GetInstance().isPaying = false;
    }
    // Use this for initialization
    private void Start()
    {
        //システム言語を取得
        if (languageText != null)
        {
            SystemLanguage lang   = Application.systemLanguage;
            var            strVal = Enum.GetName(typeof(SystemLanguage), lang);
            languageText.text = "Language = " + (int)lang + " (" + strVal + ")";
        }

        //チェックボックスの状態読み込み
        bool check = XPlayerPrefs.GetBool(gameObject.name + CHECKED_PREF, true);

        if (ynCheckToggle != null)
        {
            ynCheckToggle.isOn = check;
        }

        if (okCheckToggle != null)
        {
            okCheckToggle.isOn = check;
        }

        if (hardVolToggle != null)
        {
            hardVolToggle.isOn = FindObjectOfType <HardVolumeController>().HardOperation;
        }

#if UNITY_EDITOR
        //色変換のテスト
        string htmlString = ColorUtility.ToHtmlStringRGBA(debugColor);
        Debug.Log("htmlString = " + htmlString);
        Debug.Log("GetColorCodeString = " + XColor.GetColorCodeString(htmlString));
        Debug.Log("RedValue(html)  = " + XColor.RedValue(htmlString));
        Debug.Log("RedValue(Color) = " + debugColor.RedValue());
        Debug.Log("GreenValue(html)  = " + XColor.GreenValue(htmlString));
        Debug.Log("GreenValue(Color) = " + debugColor.GreenValue());
        Debug.Log("BlueValue(html)  = " + XColor.BlueValue(htmlString));
        Debug.Log("BlueValue(Color) = " + debugColor.BlueValue());
        Debug.Log("AlphaValue(html)  = " + XColor.AlphaValue(htmlString));
        Debug.Log("AlphaValue(Color) = " + debugColor.AlphaValue());
        int argb = debugColor.ToIntARGB();
        Debug.Log("ToIntARGB = " + argb + ", ToColor->html = " + ColorUtility.ToHtmlStringRGBA(XColor.ToColor(argb)));
        outColor = XColor.ToColor(argb);
#endif
    }
Пример #23
0
    private void SetToNextLevel()
    {
        //设置本关卡已完成
        XPlayerPrefs.SetInt(levelID + isCompleted, 1);
        //Debug.Log(XPlayerPrefs.GetInt(levelID + isCompleted));

        //下一关
        if (LevelMgr.GetInstance().GetNextLevelIDByID(levelID) == 0)
        {
            //Debug.Log("没有下一关了");
            return;
        }
        nextLevelID = LevelMgr.GetInstance().GetNextLevelIDByID(levelID);
        XPlayerPrefs.SetInt(curLevel, (int)nextLevelID);
        XPlayerPrefs.SetInt(nextLevelID + isUnlock, -1);
        LevelMgr.GetInstance().CurLevelID = nextLevelID;
    }
Пример #24
0
    public void Init()
    {
        Debuger.Init();
        Debuger.EnableLog = GameConfig.IsDebug;
        LanguageMgr.GetInstance().SetUp();
        int count = XPlayerPrefs.GetInt(StartUpCount_Tag) + 1;

        XPlayerPrefs.SetInt(StartUpCount_Tag, count);
        Application.targetFrameRate = 60;
        //UIMgr.ShowPage(UIPageEnum.Main_Page);
        processList = new List <PreProcess>()
        {
            new BinProcess(),
            new AtlasProcess(),
            new AbProcess()
        };
        StartCoroutine(Preprocess());
    }
    const string SWITCH_PREF = "_switches";     //add name (PlayerPrefs)

    //Android Switch Dialog Demo
    public void TestDialogSwitch()
    {
        if (switchChecks == null)
        {
            switchChecks = XPlayerPrefs.GetArray(gameObject.name + SWITCH_PREF, new bool[switchItems.Length]);  //(*) Note that the array will be the saved length
        }
        //(*) Activate the "DebugConsole" in the hierarchy to see its parameters.
        XDebug.Clear();
        XDebug.Log("(PlayerPrefs or init)");
        XDebug.Log(switchChecks.Select(e => e.ToString()).Aggregate((s, a) => s + ", " + a), 3);

#if UNITY_EDITOR
        Debug.Log("TestDialogSwitch called");
#elif UNITY_ANDROID
        string[] keys = (switchKeyToggle != null && !switchKeyToggle.isOn) ? null : switchKeys;
        AndroidPlugin.ShowSwitchDialog("This is Switch Dialog Demo", "Switch the Party Character", switchItems, keys, switchChecks, 0, gameObject.name, "ReceiveSwitches", "OK", "Cancel");
#endif
    }
Пример #26
0
 public LevelConfig GetNewLevel()
 {
     for (int i = 0; i < m_config.Items.Count; i++)
     {
         if (m_config.Items[i].LevelType == 1 && XPlayerPrefs.GetInt(m_config.Items[i].LevelId.ToString() + "isCompleted") == 0)
         {
             return(m_config.Items[i]);
         }
     }
     for (int i = m_config.Items.Count - 1; i >= 0; i--)
     {
         if (m_config.Items[i].LevelType == 1)
         {
             return(m_config.Items[i]);
         }
     }
     return(m_config.Items[m_config.Items.Count - 1]);
 }
Пример #27
0
    public void InterstitialTrigger(Action onReward = null, Action onFail = null, Action onClose = null)
    {
        if (isPaid())
        {
            if (onReward != null)
            {
                onReward();
            }
            return;
        }
        tmpCount = XPlayerPrefs.GetInt("StartUpCount");
        //int startUpCount = XPlayerPrefs.GetInt("StartUpCount");
        if (startUpCount != tmpCount)
        {
            startUpCount = tmpCount;
            Debug.Log("StartUpCount" + startUpCount);
            if (startUpCount > config.Params1[config.Params1.Count - 1])
            {
                index = config.Params1.Count - 1;
            }
            else
            {
                index = config.Params1.IndexOf(startUpCount);
            }
            Debug.Log("first" + index);
            playTimes = config.Params2[index];
        }
        if (playTimes == 0)
        {
            playTimes = config.Params3[index];
        }
        playTimes--;
        Debug.Log("playTimes" + playTimes);
        if (playTimes == 0)
        {
            //TODO:播放广告
            SDKMgr.GetInstance().showIntersitialAD(onReward, onFail, onClose);

#if UNITY_EDITOR
            Debug.Log("激励广告");
#endif
        }
    }
Пример #28
0
 public void ClickEnterLevel()
 {
     if (XPlayerPrefs.GetInt(levelID.ToString() + isUnlock) == -1)
     {
         Debug.Log("enter");
         if (buttonCheck)
         {
             buttonCheck = false;
             setState();
             gameObject.transform.GetComponentInParent <UILevelList>().EnterLevel();
             XPlayerPrefs.SetInt(curLevel, (int)levelID);
             XPlayerPrefs.Save();
         }
     }
     else
     {
         Debug.Log("未解锁");
     }
 }
Пример #29
0
    public IEnumerator InitPuzzleContainPanel(bool isregen = false)
    {
        yield return(new WaitForFixedUpdate());

        //TODO:如果有存档,就根据存档把拼图加进去
        if (isregen)
        {
            uint     curLevelID = LevelMgr.GetInstance().CurLevelID;
            Recorder rec        = XPlayerPrefs.GetRec(curLevelID);

            List <SettlePuzzle> settlePuzzleList = rec.settlePuzzleList;

            Debug.Log("settlePuzzleList length:" + settlePuzzleList.Count);
            foreach (SettlePuzzle settlePuzzle in settlePuzzleList)
            {
                SettlePuzzleFunc(settlePuzzle);
            }
        }
    }
Пример #30
0
    public void ClickEnter()
    {
        if (canEnter)
        {
            if (buttonCheck)
            {
                buttonCheck = false;
                //随机加载阴影图
                type = Random.Range(0, 3);
                type = 1;
                XPlayerPrefs.SetInt(shadowType, type);
                Debug.Log("pre" + shadowType + type);

                shadows[type].localScale = shadowMax;
                isShadow = true;
                canEnter = false;
            }
        }
    }