Esempio n. 1
0
 /// <summary>
 /// 点击-关闭UI
 /// </summary>
 public void OnClickForClose()
 {
     if (SceneUtil.GetCurrentScene() == ScenesEnum.MainScene)
     {
         UIHandler.Instance.OpenUIAndCloseOther <UIMainStart>(UIEnum.MainStart);
     }
     else if (SceneUtil.GetCurrentScene() == ScenesEnum.GameScene)
     {
         UIHandler.Instance.OpenUIAndCloseOther <UIGameMain>(UIEnum.GameMain);
     }
     GameDataHandler.Instance.manager.SaveGameConfig();
 }
Esempio n. 2
0
 /// <summary>
 /// 退出点击
 /// </summary>
 public void OnClickBack()
 {
     AudioHandler.Instance.PlaySound(AudioSoundEnum.ButtonForBack);
     if (SceneUtil.GetCurrentScene() == ScenesEnum.MainScene)
     {
         UIHandler.Instance.manager.OpenUIAndCloseOther <UIMainStart>(UIEnum.MainStart);
     }
     else
     {
         UIHandler.Instance.manager.OpenUIAndCloseOther <UIGameMain>(UIEnum.GameMain);
     }
     GameDataHandler.Instance.manager.SaveGameConfig();
 }
Esempio n. 3
0
 /// <summary>
 /// 初始化天气
 /// </summary>
 public virtual void InitWeather()
 {
     //设置天气
     if (SceneUtil.GetCurrentScene() == ScenesEnum.GameInnScene || SceneUtil.GetCurrentScene() == ScenesEnum.GameTownScene)
     {
         GameWeatherHandler.Instance.SetWeather(GameCommonInfo.CurrentDayData.weatherToday);
     }
     //如果是在室内
     if (GameControlHandler.Instance.manager.GetControl().transform.position.y < -50)
     {
         AudioHandler.Instance.PauseEnvironment();
     }
 }
Esempio n. 4
0
 public override void OpenUI()
 {
     base.OpenUI();
     //离开游戏回到主菜单初始化
     if (SceneUtil.GetCurrentScene() == ScenesEnum.MainScene)
     {
         btExitGame.gameObject.SetActive(false);
         btGoMain.gameObject.SetActive(false);
         btRestartDay.gameObject.SetActive(false);
     }
     else
     {
         btExitGame.gameObject.SetActive(true);
         btGoMain.gameObject.SetActive(true);
         btRestartDay.gameObject.SetActive(true);
     }
 }
Esempio n. 5
0
    /// <summary>
    /// 初始化客栈数据
    /// </summary>
    public void InitInnData()
    {
        GameDataBean      gameData      = GameDataHandler.Instance.manager.GetGameData();
        InnAttributesBean innAttributes = gameData.GetInnAttributesData();

        if (innAttributes == null)
        {
            return;
        }

        if (popupWorker != null)
        {
            popupWorker.SetContent(TextHandler.Instance.manager.GetTextById(2031));
        }
        if (popupBuild != null)
        {
            popupBuild.SetContent(TextHandler.Instance.manager.GetTextById(2032));
        }
        if (popupMenu != null)
        {
            popupMenu.SetContent(TextHandler.Instance.manager.GetTextById(2033));
        }
        if (popupBackpack != null)
        {
            popupBackpack.SetContent(TextHandler.Instance.manager.GetTextById(2034));
        }
        if (popupFavorability != null)
        {
            popupFavorability.SetContent(TextHandler.Instance.manager.GetTextById(2035));
        }
        if (popupDebug != null)
        {
            popupDebug.SetContent(TextHandler.Instance.manager.GetTextById(2036));
        }
        if (popupInnData != null)
        {
            popupInnData.SetContent(TextHandler.Instance.manager.GetTextById(2037));
        }
        if (popupSetting != null)
        {
            popupSetting.SetContent(TextHandler.Instance.manager.GetTextById(2038));
        }
        if (popupHelp != null)
        {
            popupHelp.SetContent(TextHandler.Instance.manager.GetTextById(2039));
        }
        if (popupJumpTime != null)
        {
            popupJumpTime.SetContent(TextHandler.Instance.manager.GetTextById(2040));
        }
        if (popupHotel != null)
        {
            popupHotel.SetContent(TextHandler.Instance.manager.GetTextById(2041));
        }
        if (popupFamily != null)
        {
            popupFamily.SetContent(TextHandler.Instance.manager.GetTextById(2042));
        }
        SetInnPraise(innAttributes);
        SetInnAesthetics(innAttributes);
        SetInnRichNess(innAttributes);
        SetInnLevel(innAttributes);

        //设置是否显示时间缩放
        if (SceneUtil.GetCurrentScene() != ScenesEnum.GameInnScene)
        {
            rgTimeScale.gameObject.SetActive(false);
            objLayerSelect.SetActive(false);
        }
        else
        {
            if (InnHandler.Instance.GetInnStatus() == InnHandler.InnStatusEnum.Close)
            {
                rgTimeScale.gameObject.SetActive(false);
                objLayerSelect.SetActive(false);
            }
            else
            {
                rgTimeScale.gameObject.SetActive(true);
                InnBuildBean innBuild = gameData.GetInnBuildData();
                if (innBuild.innSecondWidth != 0 && innBuild.innSecondHeight != 0)
                {
                    objLayerSelect.SetActive(true);
                }
                else
                {
                    objLayerSelect.SetActive(false);
                }
            }
        }

        //设置是否显示时间跳跃
        //if (uiGameManager.gameTimeHandler == null)
        //{
        //    btJumpTime.gameObject.SetActive(false);
        //}
        //else
        //{
        //    if(GameTimeHandler.Instance.GetDayStatus()== GameTimeHandler.DayEnum.Rest)
        //    {
        //        btJumpTime.gameObject.SetActive(true);
        //    }
        //    else
        //    {
        //        btJumpTime.gameObject.SetActive(false);
        //    }
        //}
        GameConfigBean gameConfig = GameDataHandler.Instance.manager.GetGameConfig();

        if (gameConfig.statusForWorkerNumber == 0)
        {
            workerNumber.Close();
        }
        else
        {
            if (GameTimeHandler.Instance.GetDayStatus() == GameTimeHandler.DayEnum.Work)
            {
                workerNumber.Open();
            }
            else
            {
                workerNumber.Close();
            }
        }

        //是否展示住店相关
        if (gameData.listBed.Count != 0)
        {
            btHotel.gameObject.SetActive(true);
        }
        else
        {
            btHotel.gameObject.SetActive(false);
        }
        //是否展示建造按钮
        if (SceneUtil.GetCurrentScene() == ScenesEnum.GameInnScene)
        {
            btBuild.gameObject.SetActive(true);
        }
        else
        {
            btBuild.gameObject.SetActive(false);
        }
        //是否展示家族按钮
        if (gameData.GetFamilyData().CheckMarry(gameData.gameTime))
        {
            btFamily.gameObject.SetActive(true);
        }
        else
        {
            btFamily.gameObject.SetActive(false);
        }
        //是否展示测试按钮
        if (ProjectConfigInfo.BUILD_TYPE == ProjectBuildTypeEnum.Debug)
        {
            btDebug.gameObject.SetActive(true);
        }
        else
        {
            btDebug.gameObject.SetActive(false);
        }
    }
Esempio n. 6
0
    public bool EventTriggerForStory()
    {
        if (!CheckEventTrigger())
        {
            return(false);
        }
        GameDataBean  gameData  = GameDataHandler.Instance.manager.GetGameData();
        StoryInfoBean storyInfo = StoryInfoHandler.Instance.manager.CheckStory(gameData, SceneUtil.GetCurrentScene());

        if (storyInfo != null)
        {
            EventTriggerForStory(storyInfo);
            return(true);
        }
        else
        {
            return(false);
        }
    }
Esempio n. 7
0
    /// <summary>
    /// 检测故事 自动触发剧情
    /// </summary>
    public bool EventTriggerForStory(TownBuildingEnum positionType, int OutOrIn)
    {
        if (!CheckEventTrigger())
        {
            return(false);
        }
        GameDataBean  gameData  = GameDataHandler.Instance.manager.GetGameData();
        StoryInfoBean storyInfo = StoryInfoHandler.Instance.manager.CheckStory(gameData, SceneUtil.GetCurrentScene(), positionType, OutOrIn);

        if (storyInfo != null)
        {
            EventTriggerForStory(storyInfo);
            return(true);
        }
        else
        {
            return(false);
        }
    }
Esempio n. 8
0
    /// <summary>
    /// 设置装备
    /// </summary>
    /// <param name="itemInfo"></param>
    /// <param name="isTFequip">是否是幻化</param>
    public void SetEquip(ItemsInfoBean itemInfo, bool isTFequip)
    {
        if (itemInfo == null)
        {
            return;
        }
        GameDataBean             gameData = GameDataHandler.Instance.manager.GetGameData();
        ItemGameBackpackEquipCpt itemCpt  = null;
        long        unloadEquipId         = 0;
        GeneralEnum itemType = itemInfo.GetItemsType();

        switch (itemType)
        {
        case GeneralEnum.Hat:

            if (isTFequip)
            {
                itemCpt       = equipTFHat;
                unloadEquipId = characterData.equips.hatTFId;
                characterData.equips.hatTFId = itemInfo.id;
            }
            else
            {
                itemCpt       = equipHat;
                unloadEquipId = characterData.equips.hatId;
                characterData.equips.hatId = itemInfo.id;
            }

            break;

        case GeneralEnum.Clothes:
            if (isTFequip)
            {
                itemCpt       = equipTFClothes;
                unloadEquipId = characterData.equips.clothesTFId;
                characterData.equips.clothesTFId = itemInfo.id;
            }
            else
            {
                itemCpt       = equipClothes;
                unloadEquipId = characterData.equips.clothesId;
                characterData.equips.clothesId = itemInfo.id;
            }
            break;

        case GeneralEnum.Shoes:
            if (isTFequip)
            {
                itemCpt       = equipTFShoes;
                unloadEquipId = characterData.equips.shoesTFId;
                characterData.equips.shoesTFId = itemInfo.id;
            }
            else
            {
                itemCpt       = equipShoes;
                unloadEquipId = characterData.equips.shoesId;
                characterData.equips.shoesId = itemInfo.id;
            }
            break;

        case GeneralEnum.Chef:
        case GeneralEnum.Waiter:
        case GeneralEnum.Accoutant:
        case GeneralEnum.Accost:
        case GeneralEnum.Beater:
            if (isTFequip)
            {
                itemCpt       = equipTFHand;
                unloadEquipId = characterData.equips.handTFId;
                characterData.equips.handTFId = itemInfo.id;
            }
            else
            {
                itemCpt       = equipHand;
                unloadEquipId = characterData.equips.handId;
                characterData.equips.handId = itemInfo.id;
            }
            break;
        }
        itemCpt.SetData(characterData, itemInfo, null);

        //如果有卸载的装备 则添加到背包
        if (unloadEquipId != 0)
        {
            gameData.AddItemsNumber(unloadEquipId, 1);
        }
        //刷新场景中的人物
        if (SceneUtil.GetCurrentScene() == ScenesEnum.GameInnScene)
        {
            NpcHandler.Instance.builderForWorker.RefreshWorkerData();
            NpcHandler.Instance.builderForFamily.RefreshFamilyData();
        }
    }
Esempio n. 9
0
 /// <summary>
 /// 获取当前场景
 /// </summary>
 /// <returns></returns>
 public ScenesEnum GetCurrentScene()
 {
     return(SceneUtil.GetCurrentScene());
 }