Exemplo n.º 1
0
    private void Update()
    {
        if (Input.GetButton("Quit") && Time.unscaledTime > nextinput)
        {
            Debug.Log("Setting");
            nextinput = Time.unscaledTime + inputblock;
            if (DisSetting == 1)
            {
                Time.timeScale = 1; DisSetting = 0;
            }
            else
            {
                Time.timeScale = 0; DisSetting = 1;
            }
            script_UI.DisSettring(DisSetting);
        }
        if (lastPlayerInf.Int_Gold != obj_config.i_GetGold())
        {
            lastPlayerInf.Int_Gold = obj_config.i_GetGold();
            script_UI.UpdateGoldText(lastPlayerInf.Int_Gold);
        }
        if (lastPlayerInf.int_Lvl != obj_config.i_Getlvl())
        {
            lastPlayerInf.int_Lvl = obj_config.i_Getlvl();
            script_UI.LevelUp(lastPlayerInf.int_Lvl);
        }
        if (lastPlayerInf.Int_Exp != obj_config.i_GetExp())
        {
            lastPlayerInf.Int_Exp = obj_config.i_GetExp();
            script_UI.SetDisExp(lastPlayerInf.Int_Exp, (float)lastPlayerInf.Int_Exp / (obj_config.i_Getlvl() * obj_config.i_Getlvl() * obj_config.i_Getlvl()));
        }
        if (lastPlayerInf.Int_NowLife != obj_config.i_GetNowLife())
        {
            lastPlayerInf.Int_NowLife = obj_config.i_GetNowLife();
            script_UI.SetLife((float)lastPlayerInf.Int_NowLife / obj_config.i_GetMaxLife());
        }

        /*if (obj_config.i_GetGold() != pre_Config.Int_Gold)
         * {
         *  Debug.Log("changegold " + pre_Config.Int_Gold + " to " + obj_config.i_GetGold());
         *  pre_Config.Int_Gold = obj_config.i_GetGold();
         *  script_UI.UpdateGoldText(pre_Config.Int_Gold);
         * }*/
    }
Exemplo n.º 2
0
    private PlayerConfig lastPlayerInf = new PlayerConfig();//Add
    /// <summary>
    /// 初始化右侧数值
    /// </summary>
    private void Start()
    {
        DisSetting = 0;
        script_UI  = obj_UI.GetComponent <UIControlScript>();
        obj_config = GameObject.Find("GameConfig").GetComponent <MyConfig>();//Add

        str_GameMission = "关卡: " + ((obj_config.int_NowMapLevel - 1) / 5 + 1) + @"-" + ((obj_config.int_NowMapLevel - 1) % 5 + 1);
        script_UI.SetNowlvl(((obj_config.int_NowMapLevel - 1) / 5 + 1) + @"-" + ((obj_config.int_NowMapLevel - 1) % 5 + 1));

        script_UI.UpdateGoldText(obj_config.i_GetGold());

        lastPlayerInf.Int_MaxLife       = obj_config.i_GetMaxLife();
        lastPlayerInf.int_Lvl           = obj_config.i_Getlvl();
        lastPlayerInf.Int_Exp           = obj_config.i_GetExp();
        obj_config.m_player.Int_NowLife = obj_config.i_GetMaxLife();
        script_UI.SetDisExp(obj_config.i_GetExp(), (float)obj_config.i_GetExp() / (obj_config.i_Getlvl() * obj_config.i_Getlvl() * obj_config.i_Getlvl()));
        StartCoroutine(UpdateByTime(str_GameMission));
        // Missionlvl.SetActive(true);
    }