Пример #1
0
    public void OpenNewButton(int stageNum)
    {
        m_newStageNumber   = stageNum;
        m_newStageMoveTime = HeadMoveTime;
        if (m_newStageNumber == 2)
        {
            GlobalVars.InMapFTUE = true;
            m_heartUI.HideWindow();
            //进入FTUE状态
            UIFTUE ftue = UIWindowManager.Singleton.GetUIWindow <UIFTUE>();
            if (ftue == null)
            {
                ftue = UIWindowManager.Singleton.CreateWindow <UIFTUE>();
            }

            ftue.ResetFTUEStep();

            System.Collections.Generic.List <FTUEData> ftueData = new System.Collections.Generic.List <FTUEData>();
            FTUEData data = new FTUEData();
            data.dialog    = Localization.instance.Get("FTUEStep0");
            data.headImage = "Speicher";
            data.from      = new Position();
            data.from.MakeItUnAvailable();
            ftueData.Add(data);             //第1句话
            data                   = new FTUEData();
            data.dialog            = Localization.instance.Get("FTUEStep1");
            data.headImage         = "Speicher";
            data.pointToGameObject = "Stage1";
            data.from              = new Position();
            data.from.MakeItUnAvailable();
            ftueData.Add(data);             //第2句话
            data           = new FTUEData();
            data.dialog    = Localization.instance.Get("FTUEStep2");
            data.headImage = "Speicher";
            data.from      = new Position();
            data.from.MakeItUnAvailable();
            ftueData.Add(data);             //第3句话

            ftue.ShowFTUE(0, ftueData);
        }
    }
Пример #2
0
 public void PushFTUEData(FTUEData data)
 {
     m_ftueData.Add(data);
 }
Пример #3
0
    public override void OnUpdate()
    {
        base.OnUpdate();

        if (uiWindowState != UIWindowStateEnum.Show)
        {
            return;
        }

        GlobalVars.RefreshHeart();

        //显示心数和时间////////////////////////////////////////////////////////////////////////
        if (!m_heartUI.Visible)
        {
            if (!GlobalVars.InMapFTUE)
            {
                m_heartUI.ShowWindow();
            }
        }
        else
        {
            UISprite heartNum = m_heartUI.GetChildComponent <UISprite>("HeartNum");
            heartNum.spriteName = "Large_" + GlobalVars.HeartCount;
            m_coinNumber.SetNumber((int)Unibiller.GetCurrencyBalance("gold"));

            if (GlobalVars.HeartCount < 5)               //若心没满,要显示时间
            {
                if (!m_timeNumber.activeSelf)
                {
                    m_timeNumber.SetActive(true);
                }

                int ticks           = (int)((System.DateTime.Now.Ticks - GlobalVars.GetHeartTime.Ticks) / 10000);
                int ticksToGetHeart = CapsConfig.Instance.GetHeartInterval * 1000 - ticks;
                int min             = ticksToGetHeart / 1000 / 60;
                int second          = ticksToGetHeart / 1000 % 60;
                m_minNumber.SetNumberRapid(min);
                m_secNumber.SetNumberRapid(second);
            }
            else
            {
                if (m_timeNumber.activeSelf)
                {
                    m_timeNumber.SetActive(false);
                }
            }
        }

        if (GlobalVars.InMapFTUE)
        {
            return;
        }

        //处理头像在地图上移动
        if (m_newStageNumber > -1)          //若正在移动
        {
            m_newStageMoveTime -= Time.deltaTime;
            if (m_newStageMoveTime < 0)     //若移动到了
            {
                RefreshButtonStar(m_newStageNumber);
                AddStagePartile(m_newStageNumber);
                m_headSprite.gameObject.transform.localPosition = new Vector3(m_stageBtns[m_newStageNumber - 1].localPosition.x, m_stageBtns[m_newStageNumber - 1].localPosition.y + HeadYOffset, m_stageBtns[m_newStageNumber - 1].localPosition.z); ////移到目标点
                GlobalVars.HeadStagePos = GlobalVars.AvailabeStageCount;                                                                                                                                                                              //记录头像移动
                PlayerPrefs.SetInt("HeadStagePos", GlobalVars.HeadStagePos);                                                                                                                                                                          //记录
                RefreshButton(m_newStageNumber - 1);
                if (m_newStageNumber >= 2)
                {
                    RefreshButton(m_newStageNumber - 2);
                }

                if (m_newStageNumber == 2)                                      //需要出FTUE的情况
                {
                    GlobalVars.InMapFTUE = true;
                    m_heartUI.HideWindow();
                    //进入FTUE状态
                    UIFTUE ftue = UIWindowManager.Singleton.GetUIWindow <UIFTUE>();
                    if (ftue == null)
                    {
                        ftue = UIWindowManager.Singleton.CreateWindow <UIFTUE>();
                    }

                    ftue.ResetFTUEStep();
                    System.Collections.Generic.List <FTUEData> ftueData = new System.Collections.Generic.List <FTUEData>();
                    FTUEData data = new FTUEData();
                    data.dialog            = Localization.instance.Get("FTUEStep3");
                    data.headImage         = "Speicher";
                    data.pointToGameObject = "Stage2";
                    data.from = new Position();
                    data.from.MakeItUnAvailable();
                    ftueData.Add(data);             //第4句话
                    data = new FTUEData();

                    ftue.ShowFTUE(0, ftueData);
                }
                else                                                            //不需要出FTUE,自动点关卡按钮
                {
                    int tempNum = m_newStageNumber;
                    Timer.AddDelayFunc(1.0f, delegate()
                    {
                        UIButton.current = m_stageBtns[tempNum - 1].GetComponent <UIButton>();
                        OnStageClicked();
                    });
                }

                m_newStageNumber = -1;

                m_inputBlocker.SetActive(false);
            }
            else
            {
                if (!m_inputBlocker.activeInHierarchy)
                {
                    m_inputBlocker.SetActive(true);
                }
                Vector3 target  = new Vector3(m_stageBtns[m_newStageNumber - 1].localPosition.x, m_stageBtns[m_newStageNumber - 1].localPosition.y + HeadYOffset, m_stageBtns[m_newStageNumber - 1].localPosition.z);
                Vector3 fromPos = m_stageBtns[m_newStageNumber - 2].localPosition;
                fromPos.y += HeadYOffset;
                m_headSprite.gameObject.transform.localPosition = Vector3.Lerp(fromPos, target, (1 - m_newStageMoveTime / HeadMoveTime));
            }
        }
        //5105 - 2045 = 3060
        //处理云的移动
        //float y = (mUIObject.transform.localPosition.y - (454.0f)) * 3054 / 3964.0f;
        //m_cloudSprite.transform.LocalPositionY(-y);

        m_cloudSprite.LocalPositionY((m_mapObj.transform.localPosition.y * 2) % 1135);

        if (m_cloudSprite.transform.localPosition.y > 0)
        {
            m_cloud2Sprite.transform.LocalPositionY(m_cloudSprite.transform.localPosition.y - 1135);
        }
        else
        {
            m_cloud2Sprite.transform.LocalPositionY(m_cloudSprite.transform.localPosition.y + 1135);
        }

        if (m_stageUI.Visible)
        {
            m_lastClickStageTime = Timer.GetRealTimeSinceStartUp();     //更新关卡点击时间
        }
        //else if (Timer.GetRealTimeSinceStartUp() - m_lastClickStageTime > 5.0f)      //5秒没有有效操作
        else
        {
            SetStageHelp(true);
        }

        if (m_stageUI.Visible)                       //若关卡UI显示了
        {
            if (!m_blurSprites[0].activeInHierarchy) //若模糊层没显示
            {
                for (int i = 0; i < 3; ++i)
                {
                    m_blurSprites[i].SetActive(true);
                    m_blurSprites[i].GetComponent <TweenAlpha>().Play(true);
                }
                EventDelegate.Set(m_blurSprites[0].GetComponent <TweenAlpha>().onFinished, null);
            }
        }
        else
        {
            if (m_blurSprites[0].activeInHierarchy)
            {
                for (int i = 0; i < 3; ++i)
                {
                    m_blurSprites[i].GetComponent <TweenAlpha>().Play(false);
                }
                EventDelegate.Set(m_blurSprites[0].GetComponent <TweenAlpha>().onFinished, delegate()
                {
                    for (int i = 0; i < 3; ++i)
                    {
                        m_blurSprites[i].SetActive(false);
                    }
                });
            }
        }
    }
Пример #4
0
    public void LoadStageData(int levelNum)
    {
        _config = new ConfigOperator("Level" + levelNum);
        _config.Read();
		
        int targetInt = 0;
        _config.GetIntValue("Target", out targetInt);
        Target = (GameTarget)targetInt;
        _config.GetIntValue("StepLimit", out StepLimit);
        _config.GetIntValue("TimeLimit", out TimeLimit);
        _config.GetIntValue("ColorCount", out ColorCount);
        _config.GetIntValue("Nut1Count", out Nut1Count);
        _config.GetIntValue("Nut2Count", out Nut2Count);
        _config.GetIntValue("NutInitCount", out NutInitCount);
        _config.GetIntValue("NutMaxCount", out NutMaxCount);
        _config.GetIntValue("NutMinCount", out NutMinCount);
        _config.GetIntValue("NutStep", out NutStep);
        _config.GetIntValue("PlusInitCount", out PlusInitCount);
        _config.GetIntValue("PlusMaxCount", out PlusMaxCount);
        _config.GetIntValue("PlusStartTime", out PlusStartTime);
        if (!_config.GetIntValue("PlusStepMin", out PlusStepMin))
        {
            PlusStepMin = 5;
        }
        if (!_config.GetIntValue("PlusStepMax", out PlusStepMax))
        {
            PlusStepMax = 10;
        }
        _config.GetIntValue("Seed", out Seed);

        if (ColorCount == 0)
        {
            ColorCount = 7;
        }

        string temp;
        _config.GetStringValue("StarScore", out temp);
        string [] scoreTokens = temp.Split(',');
        for (int i = 0; i < 3; ++i)
        {
            StarScore[i] = (int)System.Convert.ChangeType(scoreTokens[i], typeof(int));
        }

        if (_config.GetStringValue("CollectCount", out temp))
        {
            string[] collectCountTokens = temp.Split(',');
            for (int i = 0; i < 3; ++i)
            {
                CollectCount[i] = System.Convert.ToInt32(collectCountTokens[i]);
            }
        }

        if (_config.GetStringValue("CollectColors", out temp))
        {
            string[] collectColorTokens = temp.Split(',');
            for (int i = 0; i < 3; ++i)
            {
                CollectColors[i] = (TBlockColor)System.Convert.ToInt32(collectColorTokens[i]);
            }
        }

        if (_config.GetStringValue("CollectSpecial", out temp))
        {
            string[] collectSpecialTokens = temp.Split(',');
            for (int i = 0; i < 3; ++i)
            {
                CollectSpecial[i] = (TSpecialBlock)System.Convert.ToInt32(collectSpecialTokens[i]);
            }
        }

        //GridData

        _config.GetStringValue("GridDataArray", out temp);

        string[] gridDataTokens = temp.Split(',');
        for (int i = 0; i < GameLogic.BlockCountX; ++i )
        {
            for (int j = 0; j < GameLogic.BlockCountY; ++j )
            {
                int number = (int)System.Convert.ChangeType(gridDataTokens[j * GameLogic.BlockCountX + i], typeof(int));
                if ((number & (int)GridFlag.Chocolate) > 0)
                {
                    ++ChocolateCount;
                }
                if ((number & (int)GridFlag.Stone) > 0)
                {
                    ++StoneCount;
                }
                if ((number & (int)GridFlag.Iron) > 0)
                {
                    ++StoneCount;
                }
                GridData[i, j] = number;
            }
        }

        PortalToMap.Clear();
        PortalFromMap.Clear();
        //Portals
        _config.GetStringValue("PortalArray", out temp);
        if (temp != null)
        {
            string[] portalDataTokens = temp.Split(',');
            for (int i = 0; i < portalDataTokens.Length - 4; i += 5)
            {
                Portal portal = new Portal();
                portal.from = new Position((int)System.Convert.ChangeType(portalDataTokens[i], typeof(int)), (int)System.Convert.ChangeType(portalDataTokens[i + 1], typeof(int)));
                portal.to = new Position((int)System.Convert.ChangeType(portalDataTokens[i + 2], typeof(int)), (int)System.Convert.ChangeType(portalDataTokens[i + 3], typeof(int)));
                portal.flag = (int)System.Convert.ChangeType(portalDataTokens[i + 4], typeof(int));
                PortalToMap.Add(portal.to.ToInt(), portal);
                PortalFromMap.Add(portal.from.ToInt(), portal);
            }
        }

        SpecialBlock.Clear();           //清理已有内容
        //Portals
        _config.GetStringValue("SpecialArray", out temp);
        if (temp != null)
        {
            string[] specialDataTokens = temp.Split(',');
            for (int i = 0; i < specialDataTokens.Length - 2; i += 3)
            {
                Position pos = new Position((int)System.Convert.ChangeType(specialDataTokens[i], typeof(int)), (int)System.Convert.ChangeType(specialDataTokens[i + 1], typeof(int)));
                int special = (int)System.Convert.ChangeType(specialDataTokens[i + 2], typeof(int));
                SpecialBlock.Add(pos.ToInt(), special);
            }
        }

        Debug.Log("Level " + levelNum + " Loaded");

        FTUEMap.Clear();

        string ftue = ResourceManager.Singleton.LoadTextFile("FTUE" + levelNum);
        if (ftue != string.Empty)
        {
            List<FTUEData> curFTUEGroup = new List<FTUEData>();
            int step = -1;
            StringReader sr = new StringReader(ftue);
            string line = sr.ReadLine();
            while (line != null)
            {
                if (line.Contains("//"))
                {
                    line = sr.ReadLine();
                    continue;
                }
                if (string.IsNullOrEmpty(line))
                {
                    line = sr.ReadLine();
                    continue;
                }
                string[] values = line.Split(new string[] { "\t", " " }, System.StringSplitOptions.RemoveEmptyEntries);
                if (values.Length > 0)
                {
                    int num = System.Convert.ToInt32(values[0]);

                    if (step == -1)
                    {
                        step = num;
                        FTUEMap.Add(step, curFTUEGroup);                               //添加一个组
                    }
                    else if(num != step)
                    {
                        curFTUEGroup = new List<FTUEData>();
                        step = num;
                        FTUEMap.Add(step, curFTUEGroup);                               //添加一个组
                    }
                    

                    FTUEData data = new FTUEData();
                    data.highLightPosList = new List<Position>();
                    data.headImage = values[1];
                    data.dialog = values[2];
                    string[] posArray;
                    if (values[3] != "None")
                    {
                        posArray = values[3].Split(',');
                        data.from.x = System.Convert.ToInt32(posArray[0]);
                        data.from.y = System.Convert.ToInt32(posArray[1]);
                    }
                    else
                    {
                        data.from.MakeItUnAvailable();
                    }


                    if (values[4] != "None")
                    {
                        posArray = values[4].Split(',');
                        data.to.x = System.Convert.ToInt32(posArray[0]);
                        data.to.y = System.Convert.ToInt32(posArray[1]);
                    }
                    else
                    {
                        data.to.MakeItUnAvailable();
                    }

                    if (values[5] != "None")
                    {
                        posArray = values[5].Split(',');
                        for (int i = 0; i < posArray.Length / 2; ++i)
                        {
                            int x = System.Convert.ToInt32(posArray[i * 2]);
                            int y = System.Convert.ToInt32(posArray[i * 2 + 1]);
                            data.highLightPosList.Add(new Position(x, y));
                        }
                    }

                    if (values.Length > 6)
                    {
                        data.pic = values[6];
                    }
                    else
                    {
                        data.pic = "None";
                    }

                    if (values.Length > 7)
                    {
                        if (System.Convert.ToInt32(values[7]) == 1)
                        {
                            data.bHighLightBackground = true;
                            data.bHighLightBlock = false;
                        }
                        else if (System.Convert.ToInt32(values[7]) == 2)
                        {
                            data.bHighLightBackground = true;
                            data.bHighLightBlock = true;
                        }
						else if (System.Convert.ToInt32(values[7]) == 0)
						{
							data.bHighLightBackground = false;
                        	data.bHighLightBlock = true;
						}
                    }
                    else
                    {
                        data.bHighLightBackground = false;
                        data.bHighLightBlock = true;
                    }

                    if (values.Length > 8)
                    {
                        posArray = values[8].Split(',');

                        data.dialogPos = System.Convert.ToInt32(posArray[0]);
                        data.picturePos = System.Convert.ToInt32(posArray[1]);
                    }

                    curFTUEGroup.Add(data);                               //添加对话数据
                }

                line = sr.ReadLine();
            }
            sr.Close();
        }
    }
Пример #5
0
    public override void OnUpdate()
    {
        base.OnUpdate();

        if (uiWindowState != UIWindowStateEnum.Show)
        {
            return;
        }

        GlobalVars.RefreshHeart();

        //显示心数和时间////////////////////////////////////////////////////////////////////////
        if (!m_heartUI.Visible)
        {
            if (!GlobalVars.InMapFTUE)
            {
                m_heartUI.ShowWindow();
            }
        }
        else
        {
            UISprite heartNum = m_heartUI.GetChildComponent<UISprite>("HeartNum");
            heartNum.spriteName = "Large_" + GlobalVars.HeartCount;
            m_coinNumber.SetNumber((int)Unibiller.GetCurrencyBalance("gold"));

            if (GlobalVars.HeartCount < 5)               //若心没满,要显示时间
            {
                if (!m_timeNumber.activeSelf)
                {
                    m_timeNumber.SetActive(true);
                }

                int ticks = (int)((System.DateTime.Now.Ticks - GlobalVars.GetHeartTime.Ticks) / 10000);
                int ticksToGetHeart = CapsConfig.Instance.GetHeartInterval * 1000 - ticks;
                int min = ticksToGetHeart / 1000 / 60;
                int second = ticksToGetHeart / 1000 % 60;
                m_minNumber.SetNumberRapid(min);
                m_secNumber.SetNumberRapid(second);
            }
            else
            {
                if (m_timeNumber.activeSelf)
                {
                    m_timeNumber.SetActive(false);
                }
            }
        }

        if (GlobalVars.InMapFTUE)
        {
            return;
        }

        //处理头像在地图上移动
        if (m_newStageNumber > -1)          //若正在移动
        {
            m_newStageMoveTime -= Time.deltaTime;
            if (m_newStageMoveTime < 0)     //若移动到了
            {
                RefreshButtonStar(m_newStageNumber);
                AddStagePartile(m_newStageNumber);
                m_headSprite.gameObject.transform.localPosition = new Vector3(m_stageBtns[m_newStageNumber - 1].localPosition.x, m_stageBtns[m_newStageNumber - 1].localPosition.y + HeadYOffset, m_stageBtns[m_newStageNumber - 1].localPosition.z);            ////移到目标点     
                GlobalVars.HeadStagePos = GlobalVars.AvailabeStageCount;        //记录头像移动
                PlayerPrefs.SetInt("HeadStagePos", GlobalVars.HeadStagePos);    //记录
				RefreshButton(m_newStageNumber - 1);
                if (m_newStageNumber >= 2)
                {
                    RefreshButton(m_newStageNumber - 2);
                }

                if (m_newStageNumber == 2)                                      //需要出FTUE的情况
                {
                    GlobalVars.InMapFTUE = true;
                    m_heartUI.HideWindow();
                    //进入FTUE状态
                    UIFTUE ftue = UIWindowManager.Singleton.GetUIWindow<UIFTUE>();
                    if (ftue == null)
                    {
                        ftue = UIWindowManager.Singleton.CreateWindow<UIFTUE>();
                    }

                    ftue.ResetFTUEStep();
                    System.Collections.Generic.List<FTUEData> ftueData = new System.Collections.Generic.List<FTUEData>();
                    FTUEData data = new FTUEData();
                    data.dialog = Localization.instance.Get("FTUEStep3");
                    data.headImage = "Speicher";
                    data.pointToGameObject = "Stage2";
                    data.from = new Position();
                    data.from.MakeItUnAvailable();
                    ftueData.Add(data);             //第4句话
                    data = new FTUEData();

                    ftue.ShowFTUE(0, ftueData);
                }
                else                                                            //不需要出FTUE,自动点关卡按钮
                {
                    int tempNum = m_newStageNumber;
                    Timer.AddDelayFunc(1.0f, delegate()
                    {
                        UIButton.current = m_stageBtns[tempNum - 1].GetComponent<UIButton>();
                        OnStageClicked();
                    });
                }

                m_newStageNumber = -1;

                m_inputBlocker.SetActive(false);
            }
            else
            {
                if (!m_inputBlocker.activeInHierarchy)
                {
                    m_inputBlocker.SetActive(true);
                }
                Vector3 target = new Vector3(m_stageBtns[m_newStageNumber - 1].localPosition.x, m_stageBtns[m_newStageNumber - 1].localPosition.y + HeadYOffset, m_stageBtns[m_newStageNumber - 1].localPosition.z);
                Vector3 fromPos = m_stageBtns[m_newStageNumber - 2].localPosition;
                fromPos.y += HeadYOffset;
                m_headSprite.gameObject.transform.localPosition = Vector3.Lerp(fromPos, target, (1 - m_newStageMoveTime / HeadMoveTime));
            }
        }
        //5105 - 2045 = 3060
        //处理云的移动
        //float y = (mUIObject.transform.localPosition.y - (454.0f)) * 3054 / 3964.0f;
        //m_cloudSprite.transform.LocalPositionY(-y);

        m_cloudSprite.LocalPositionY((m_mapObj.transform.localPosition.y * 2) % 1135);
		
		if(m_cloudSprite.transform.localPosition.y > 0)
		{
            m_cloud2Sprite.transform.LocalPositionY(m_cloudSprite.transform.localPosition.y - 1135);
		}
		else
		{
            m_cloud2Sprite.transform.LocalPositionY(m_cloudSprite.transform.localPosition.y + 1135);
		}

        if (m_stageUI.Visible)
        {
            m_lastClickStageTime = Timer.GetRealTimeSinceStartUp();     //更新关卡点击时间
        }
        //else if (Timer.GetRealTimeSinceStartUp() - m_lastClickStageTime > 5.0f)      //5秒没有有效操作
        else
        {
            SetStageHelp(true);
        }

        if (m_stageUI.Visible)      //若关卡UI显示了
        {
            if (!m_blurSprites[0].activeInHierarchy)        //若模糊层没显示
            {
                for (int i = 0; i < 3;++i )
                {
                    m_blurSprites[i].SetActive(true);
                    m_blurSprites[i].GetComponent<TweenAlpha>().Play(true);
                }
                EventDelegate.Set(m_blurSprites[0].GetComponent<TweenAlpha>().onFinished, null);
            }
        }
        else
        {
            if (m_blurSprites[0].activeInHierarchy)
            {
                for (int i = 0; i < 3; ++i)
                {
                    m_blurSprites[i].GetComponent<TweenAlpha>().Play(false);
                }
                EventDelegate.Set(m_blurSprites[0].GetComponent<TweenAlpha>().onFinished, delegate()
                {
                    for (int i = 0; i < 3; ++i)
                    {
                        m_blurSprites[i].SetActive(false);
                    }
                });
            }
        }
    }
Пример #6
0
    public void OpenNewButton(int stageNum)
    {
        m_newStageNumber = stageNum;
        m_newStageMoveTime = HeadMoveTime;
        if (m_newStageNumber == 2)
        {
            GlobalVars.InMapFTUE = true;
            m_heartUI.HideWindow();
            //进入FTUE状态
            UIFTUE ftue = UIWindowManager.Singleton.GetUIWindow<UIFTUE>();
            if (ftue == null)
            {
                ftue = UIWindowManager.Singleton.CreateWindow<UIFTUE>();
            }

            ftue.ResetFTUEStep();

            System.Collections.Generic.List<FTUEData> ftueData = new System.Collections.Generic.List<FTUEData>();
            FTUEData data = new FTUEData();
            data.dialog = Localization.instance.Get("FTUEStep0");
            data.headImage = "Speicher";
            data.from = new Position();
            data.from.MakeItUnAvailable();
            ftueData.Add(data);             //第1句话
            data = new FTUEData();
            data.dialog = Localization.instance.Get("FTUEStep1");
            data.headImage = "Speicher";
            data.pointToGameObject = "Stage1";
            data.from = new Position();
            data.from.MakeItUnAvailable();
            ftueData.Add(data);             //第2句话
            data = new FTUEData();
            data.dialog = Localization.instance.Get("FTUEStep2");
            data.headImage = "Speicher";
            data.from = new Position();
            data.from.MakeItUnAvailable();
            ftueData.Add(data);             //第3句话

            ftue.ShowFTUE(0, ftueData);
        }
    }
Пример #7
0
 public void PushFTUEData(FTUEData data)
 {
     m_ftueData.Add(data);
 }