/// <summary>
    /// 创建前置数据
    /// </summary>
    /// <param name="preData"></param>
    public void CreatePreDataItem(string preData)
    {
        List <PreTypeBean> listPreData = PreTypeEnumTools.GetListPreData(preData);
        GameDataBean       gameData    = GameDataHandler.Instance.manager.GetGameData();

        foreach (var itemData in listPreData)
        {
            GameObject objPre = Instantiate(objPreContainer, objPreModel);
            PreTypeEnumTools.GetPreDetails(itemData, gameData);
            //设置图标
            Sprite spIcon = itemData.spPreIcon;
            Image  ivIcon = CptUtil.GetCptInChildrenByName <Image>(objPre, "Icon");
            ivIcon.sprite = spIcon;
            //设置描述
            string preDes    = itemData.preDescribe;
            Text   tvContent = CptUtil.GetCptInChildrenByName <Text>(objPre, "Text");
            tvContent.text = preDes;
            //设置是否满足条件
            Image ivStatus = CptUtil.GetCptInChildrenByName <Image>(objPre, "Status");
            if (itemData.isPre)
            {
                ivStatus.sprite = spRePre;
                tvContent.color = colorPre;
            }
            else
            {
                isAllPre        = false;
                ivStatus.sprite = spUnPre;
                tvContent.color = colorUnPre;
            }
        }
        GameUtil.RefreshRectViewHight((RectTransform)objPreContainer.transform, true);
        GameUtil.RefreshRectViewHight((RectTransform)transform, true);
    }
Ejemplo n.º 2
0
 protected override void Awake()
 {
     base.Awake();
     audioSourceForMusic       = CptUtil.GetCptInChildrenByName <AudioSource>(Camera.main.gameObject, "Music");
     audioSourceForSound       = CptUtil.GetCptInChildrenByName <AudioSource>(Camera.main.gameObject, "Sound");
     audioSourceForEnvironment = CptUtil.GetCptInChildrenByName <AudioSource>(Camera.main.gameObject, "Environment");
 }
Ejemplo n.º 3
0
    public void SetDataForTeamCustomer(long teamId)
    {
        CptUtil.RemoveChildsByActive(objLoveMenuContainer);
        //获取团队数据
        NpcTeamBean npcTeamData = NpcTeamHandler.Instance.manager.GetCustomerTeam(teamId);

        if (npcTeamData == null)
        {
            return;
        }
        //获取喜爱的菜单
        List <long>         listLoveMenu    = npcTeamData.GetLoveMenus();
        GameDataBean        gameData        = GameDataHandler.Instance.manager.GetGameData();
        UserAchievementBean userAchievement = gameData.GetAchievementData();

        foreach (long menuId in listLoveMenu)
        {
            MenuInfoBean    menuInfo     = InnFoodHandler.Instance.manager.GetFoodDataById(menuId);
            Sprite          spFood       = InnFoodHandler.Instance.manager.GetFoodSpriteByName(menuInfo.icon_key);
            GameObject      objLoveMenu  = Instantiate(objLoveMenuContainer, objLoveMenuModel);
            ItemBaseTextCpt itemLoveMenu = objLoveMenu.GetComponent <ItemBaseTextCpt>();

            if (userAchievement.CheckHasTeamCustomerLoveMenu(teamId, menuId))
            {
                itemLoveMenu.SetData(spFood, menuInfo.name, "");
            }
            else
            {
                itemLoveMenu.SetData(spUnLock, "???", Color.gray, "");
            }
        }
    }
Ejemplo n.º 4
0
    /// <summary>
    /// 设置数据
    /// </summary>
    /// <param name="innRecordData"></param>
    public void SetData(InnRecordBean innRecordData)
    {
        SetDate(innRecordData.year, innRecordData.month, innRecordData.day);
        SetStatus((DayEnum)innRecordData.status);

        innRecordData.GetTotalIncome(out long incomeL, out long incomeM, out long incomeS);
        SetTotalIncome(incomeL, incomeM, incomeS);

        innRecordData.GetTotalExpenses(out long expensesL, out long expensesM, out long expensesS);
        SetTotalExpenses(expensesL, expensesM, expensesS);

        SetPraise(
            innRecordData.praiseExcitedNumber,
            innRecordData.praiseHappyNumber,
            innRecordData.praiseOkayNumber,
            innRecordData.praiseOrdinaryNumber,
            innRecordData.praiseDisappointedNumber,
            innRecordData.praiseAngerNumber);
        SetConsumeIng(
            innRecordData.consumeIngOilsalt,
            innRecordData.consumeIngMeat,
            innRecordData.consumeIngRiverfresh,
            innRecordData.consumeIngSeafood,
            innRecordData.consumeIngVegetables,
            innRecordData.consumeIngMelonfruit,
            innRecordData.consumeIngWaterwine,
            innRecordData.consumeIngFlour);
        CptUtil.RemoveChildsByActive(objShowContainer);
        SetHotel(innRecordData.incomeForHotelL, innRecordData.incomeForHotelM, innRecordData.incomeForHotelS);
        SetFoodSellList(innRecordData.listSellNumber, innRecordData.incomeL, innRecordData.incomeM, innRecordData.incomeS);
    }
Ejemplo n.º 5
0
    public void SetBuildingData(BuildingInfoBean itemData)
    {
        GameObject objBuilding = GameObject.Find("Building");
        GameObject objModel    = GameObject.Find("Model");

        CptUtil.RemoveChildsByActiveInEditor(objBuilding);
        List <BuildingBean> listData = itemData.listBuildingData;

        if (listData == null)
        {
            return;
        }
        for (int i = 0; i < listData.Count; i++)
        {
            BuildingBean buildingData = listData[i];
            GameObject   objItem      = Instantiate(objModel);
            objItem.SetActive(true);
            objItem.transform.SetParent(objBuilding.transform);

            BuildingEditor buildingEditor = objItem.GetComponent <BuildingEditor>();
            buildingEditor.direction          = (DirectionEnum)buildingData.direction;
            buildingEditor.blockType          = (BlockTypeEnum)buildingData.blockId;
            buildingEditor.randomRate         = buildingData.randomRate;
            buildingEditor.transform.position = buildingData.GetPosition();
            buildingEditor.OnValidate();
        }
    }
Ejemplo n.º 6
0
    /// <summary>
    /// 创建商品列表
    /// </summary>
    /// <param name="listData"></param>
    public void CreateGroceryData(List <StoreInfoBean> listData)
    {
        CptUtil.RemoveChildsByActive(objGuidStoreContent.transform);
        if (listData == null || objGuidStoreContent == null)
        {
            return;
        }
        GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData();

        for (int i = 0; i < listData.Count; i++)
        {
            StoreInfoBean itemData = listData[i];
            //检测是否满足前置成就
            if (!itemData.CheckPreAchIds(gameData))
            {
                continue;
            }
            GameObject itemObj = null;
            if (itemData.mark_type == 1)
            {
                itemObj = Instantiate(objGuidStoreContent, objGuidStoreForItemsModel);
                ItemTownStoreForGoodsCpt groceryCpt = itemObj.GetComponent <ItemTownStoreForGoodsCpt>();
                groceryCpt.SetData(itemData);
            }
            else if (itemData.mark_type == 2)
            {
                itemObj = Instantiate(objGuidStoreContent, objGuidStoreForBuildModel);
                ItemTownCerpenterCpt cerpenterCpt = itemObj.GetComponent <ItemTownCerpenterCpt>();
                cerpenterCpt.SetData(itemData);
            }
            itemObj.transform.DOScale(new Vector3(0, 0, 0), 0.5f).SetEase(Ease.OutBack).SetDelay(i * 0.05f).From();
        }
    }
Ejemplo n.º 7
0
    private new void Awake()
    {
        base.Awake();
        restartBT   = CptUtil.getCptFormParentByName <Transform, Button>(transform, "RestartButton");
        restartText = CptUtil.getCptFormParentByName <Transform, Text>(transform, "RestartText");

        exitBT   = CptUtil.getCptFormParentByName <Transform, Button>(transform, "ExitButton");
        exitText = CptUtil.getCptFormParentByName <Transform, Text>(transform, "ExitText");

        replayBT   = CptUtil.getCptFormParentByName <Transform, Button>(transform, "ReplayButton");
        replayText = CptUtil.getCptFormParentByName <Transform, Text>(transform, "ReplayText");

        saveAndExitBT   = CptUtil.getCptFormParentByName <Transform, Button>(transform, "SaveAndExitButton");
        saveAndExitText = CptUtil.getCptFormParentByName <Transform, Text>(transform, "SaveAndExitText");

        restartBT.onClick.AddListener(restartOnClick);
        exitBT.onClick.AddListener(exitOnClick);
        replayBT.onClick.AddListener(replayOnClick);
        saveAndExitBT.onClick.AddListener(saveAndExitOnClick);

        gameCancelBT = CptUtil.getCptFormParentByName <Transform, Button>(transform, "GameCancelBT");
        gameCancelBT.onClick.AddListener(cancelUI);

        restartText.text     = CommonData.getText(38);
        exitText.text        = CommonData.getText(39);
        replayText.text      = CommonData.getText(40);
        saveAndExitText.text = CommonData.getText(84);
    }
Ejemplo n.º 8
0
 /// <summary>
 /// 设置食物数据
 /// </summary>
 /// <param name="innFoodManager"></param>
 /// <param name="listFood"></param>
 public void AddFoodData(List <ItemBean> listFood)
 {
     CptUtil.RemoveChildsByActive(objItemMenuContent.transform);
     if (listFood == null || listFood.Count == 0)
     {
         objItemMenuContent.SetActive(false);
         return;
     }
     objItemMenuContent.SetActive(true);
     foreach (ItemBean itemData in listFood)
     {
         //获取食物数据
         MenuInfoBean menuInfo = InnFoodHandler.Instance.manager.GetFoodDataById(itemData.itemId);
         if (menuInfo == null)
         {
             continue;
         }
         //获取食物图标
         Sprite spFoodIcon = InnFoodHandler.Instance.manager.GetFoodSpriteByName(menuInfo.icon_key);
         //生成Item
         GameObject foodInfoCpt = Instantiate(objItemMenuContent, objItemMenuModel);
         //设置数据
         ItemGameWokerDetailsChefFoodInfoCpt itemCpt = foodInfoCpt.GetComponent <ItemGameWokerDetailsChefFoodInfoCpt>();
         itemCpt.SetData(menuInfo.name, itemData.itemNumber, spFoodIcon);
     }
 }
Ejemplo n.º 9
0
    public void CreateSkillList(List <SkillInfoBean> listData)
    {
        CptUtil.RemoveChildsByActive(objSkillItemContainer);
        if (CheckUtil.ListIsNull(listData))
        {
            tvNull.gameObject.SetActive(true);
            return;
        }
        else
        {
            tvNull.gameObject.SetActive(false);
        }
        for (int i = 0; i < listData.Count; i++)
        {
            SkillInfoBean itemSkill = listData[i];
            if (!listSkill.Contains(itemSkill.id))
            {
                continue;
            }
            GameObject       objItem        = Instantiate(objSkillItemContainer, objSkillItemModel);
            ItemBaseTextCpt  itemBaseText   = objItem.GetComponent <ItemBaseTextCpt>();
            PopupSkillButton infoSkillPopup = objItem.GetComponent <PopupSkillButton>();

            Sprite spIcon = IconDataHandler.Instance.manager.GetIconSpriteByName(itemSkill.icon_key);
            itemBaseText.SetData(spIcon, itemSkill.name, "");
            infoSkillPopup.SetData(itemSkill);
        }
    }
Ejemplo n.º 10
0
    private void createLeaderBoardItem(LeaderBoardItemData itemData)
    {
        GameObject itemObj = Instantiate(ResourcesManager.LoadData <GameObject>(LeaderBoardItemPath));

        //设置大小
        RectTransform rect      = itemObj.GetComponent <RectTransform>();
        float         itemWith  = mWorldRank.GetComponent <RectTransform>().rect.width;
        float         itemHight = mWorldRank.GetComponent <RectTransform>().rect.width * 0.05f;

        rect.sizeDelta = new Vector2(itemWith, itemHight);

        itemObj.name = itemData.userId;
        itemObj.transform.SetParent(mWorldRank);
        itemObj.transform.localScale = Vector3.one;
        //设置头像图片
        Image userIcon = CptUtil.getCptFormParentByName <Transform, Image>(itemObj.transform, "UserIcon");

        StartCoroutine(ResourcesManager.LoadAsyncHttpImage(itemData.steamUserItemInfo.avatarmedium, userIcon));
        //设置名字
        Text userName = CptUtil.getCptFormParentByName <Transform, Text>(itemObj.transform, "UserName");

        userName.text = itemData.steamUserItemInfo.personaname;
        //设置排名
        Text userRank = CptUtil.getCptFormParentByName <Transform, Text>(itemObj.transform, "UserRank");

        userRank.text = itemData.leaderboardEntries.rank + "";
        //设置分数
        Text userScore = CptUtil.getCptFormParentByName <Transform, Text>(itemObj.transform, "UserScore");

        userScore.text = GameUtil.GetTimeStr(itemData.leaderboardEntries.score);
    }
    private new void Awake()
    {
        base.Awake();
        uploadImage = CptUtil.getCptFormParentByName <Transform, Image>(transform, "UploadImageContent");
        uploadBT    = CptUtil.getCptFormParentByName <Transform, Button>(transform, "UploadImage");

        inputName             = CptUtil.getCptFormParentByName <Transform, InputField>(transform, "InputName");
        inputHorizontalNumber = CptUtil.getCptFormParentByName <Transform, InputField>(transform, "InputHorizontalNumber");
        inputVerticalNumber   = CptUtil.getCptFormParentByName <Transform, InputField>(transform, "InputVerticalNumber");

        inputNameTitle             = CptUtil.getCptFormParentByName <Transform, Text>(transform, "InputNameTitle");
        inputHorizontalNumberTitle = CptUtil.getCptFormParentByName <Transform, Text>(transform, "InputHorizontalNumberTitle");
        inputVerticalNumberTitle   = CptUtil.getCptFormParentByName <Transform, Text>(transform, "InputVerticalNumberTitle");
        tvCancel = CptUtil.getCptFormParentByName <Transform, Text>(transform, "CancelText");
        tvSubmit = CptUtil.getCptFormParentByName <Transform, Text>(transform, "SubmitText");
        tvHint   = CptUtil.getCptFormParentByName <Transform, Text>(transform, "UploadHint");

        submitBT = CptUtil.getCptFormParentByName <Transform, Button>(transform, "SubmitBT");
        cancelBT = CptUtil.getCptFormParentByName <Transform, Button>(transform, "CancelBT");

        cancelBT.onClick.AddListener(delegate
        {
            jumpSelectUI();
        });
        refreshUI();
    }
Ejemplo n.º 12
0
    /// <summary>
    /// 设置属性
    /// </summary>
    /// <param name="data"></param>
    public void SetAttributes(SkillInfoBean data)
    {
        CptUtil.RemoveChildsByActive(objAttributeContainer);
        CreateItemAttributes("hourglass_1", TextHandler.Instance.manager.GetTextById(510) + " " + data.GetUseNumber());


        if (CheckUtil.StringIsNull(data.effect))
        {
            return;
        }
        List <EffectTypeBean> listEffectData = EffectTypeEnumTools.GetListEffectData(data.effect);

        //获取详情
        EffectDetailsEnumTools.GetEffectDetailsForCombat(data.effect_details, out string effectPSName, out int durationForRound);

        if (listEffectData == null)
        {
            return;
        }
        foreach (EffectTypeBean itemData in listEffectData)
        {
            EffectTypeEnumTools.GetEffectDetails(itemData, null);
            string describe = itemData.effectDescribe;
            if (durationForRound != 0)
            {
                describe += ("\n" + string.Format(TextHandler.Instance.manager.GetTextById(502), "" + durationForRound));
            }
            CreateItemAttributes(itemData.spIcon, itemData.colorIcon, describe);
        }
    }
Ejemplo n.º 13
0
    private void Awake()
    {
        timeText       = CptUtil.getCptFormParentByName <Transform, Text>(transform, "GameTimerText");
        timeMinuteHand = CptUtil.getCptFormParentByName <Transform, Image>(transform, "TimeMinuteHand");
        timeSecondHand = CptUtil.getCptFormParentByName <Transform, Image>(transform, "TimeSecondHand");

        mTimeSeoundText = CptUtil.getCptFormParentByName <Transform, Text>(transform, "GameTimerSeoundText");
        mTimeMinuteText = CptUtil.getCptFormParentByName <Transform, Text>(transform, "GameTimerMinuteText");
        mTimeHoursText  = CptUtil.getCptFormParentByName <Transform, Text>(transform, "GameTimerHoursText");
        mTimeDayText    = CptUtil.getCptFormParentByName <Transform, Text>(transform, "GameTimerDayText");

        mMinuteAnimaotr = mTimeMinuteText.GetComponent <Animator>();
        mHourAnimaotr   = mTimeHoursText.GetComponent <Animator>();
        mDayAnimaotr    = mTimeDayText.GetComponent <Animator>();

        if (timeMinuteHand != null)
        {
            timeMinuteAnimaotr = timeMinuteHand.GetComponent <Animator>();
        }
        if (timeSecondHand != null)
        {
            timeSecondAnimaotr = timeSecondHand.GetComponent <Animator>();
        }
        gameObject.SetActive(false);
    }
Ejemplo n.º 14
0
    /// <summary>
    /// 设置属性
    /// </summary>
    /// <param name="data"></param>
    public void SetAttributes(ItemsInfoBean data)
    {
        CptUtil.RemoveChildsByActive(objAttributeContainer);
        CreateItemAttributes("ui_ability_life", data.add_life, AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Life), colorForAttribute);
        CreateItemAttributes("ui_ability_cook", data.add_cook, TextHandler.Instance.manager.GetTextById(1), colorForAttribute);
        CreateItemAttributes("ui_ability_speed", data.add_speed, AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Speed), colorForAttribute);
        CreateItemAttributes("ui_ability_account", data.add_account, AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Account), colorForAttribute);
        CreateItemAttributes("ui_ability_charm", data.add_charm, AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Charm), colorForAttribute);
        CreateItemAttributes("ui_ability_force", data.add_force, AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Force), colorForAttribute);
        CreateItemAttributes("ui_ability_lucky", data.add_lucky, AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Lucky), colorForAttribute);

        if (CheckUtil.StringIsNull(data.effect))
        {
            return;
        }
        List <EffectTypeBean> listEffectData = EffectTypeEnumTools.GetListEffectData(data.effect);

        //获取详情
        EffectDetailsEnumTools.GetEffectDetailsForCombat(data.effect_details, out string effectPSName, out int durationForRound);

        if (listEffectData == null)
        {
            return;
        }
        foreach (EffectTypeBean itemData in listEffectData)
        {
            EffectTypeEnumTools.GetEffectDetails(itemData, null);
            string describe = itemData.effectDescribe;
            if (durationForRound != 0)
            {
                describe += ("\n" + string.Format(TextHandler.Instance.manager.GetTextById(502), "" + durationForRound));
            }
            CreateItemAttributes(itemData.spIcon, describe);
        }
    }
Ejemplo n.º 15
0
    private JigsawResourcesEnum currentResType;//当前选择数据类型

    private new void Awake()
    {
        base.Awake();

        //初始化拼图选择类型数据
        resTypeSelectView      = CptUtil.getCptFormParentByName <Transform, ScrollRect>(transform, "ResTypeSelectView");
        resTypeSelectContentTF = CptUtil.getCptFormParentByName <ScrollRect, Transform>(resTypeSelectView, "Content");
        if (resTypeSelectContentTF != null)
        {
            resTypeSelectContentSC = resTypeSelectContentTF.gameObject.AddComponent <JigsawResTypeSelect>();
            resTypeSelectContentSC.setMenuSelectUIControl(this);
        }

        //初始化拼图选择数据
        jigsawSelectView      = CptUtil.getCptFormParentByName <Transform, ScrollRect>(transform, "JigsawSelectView");
        jigsawSelectContentTF = CptUtil.getCptFormParentByName <ScrollRect, Transform>(jigsawSelectView, "Content");
        if (jigsawSelectContentTF != null)
        {
            jigsawSelectContentSC = jigsawSelectContentTF.gameObject.AddComponent <JigsawSelect>();
            jigsawSelectContentSC.setMenuSelectUIControl(this);
        }

        //初始化标题栏
        jigsawSelectTiltebar  = CptUtil.getCptFormParentByName <Transform, Transform>(transform, "TitleBar");
        titleBarExitBT        = CptUtil.getCptFormParentByName <Transform, Button>(jigsawSelectTiltebar, "ExitBT");
        titleBarJigsawPointTV = CptUtil.getCptFormParentByName <Transform, Text>(jigsawSelectTiltebar, "PuzzlesPointText");
        titleBarTitleName     = CptUtil.getCptFormParentByName <Transform, Text>(jigsawSelectTiltebar, "TitleName");
        if (titleBarExitBT != null)
        {
            titleBarExitBT.onClick.AddListener(addExitOnClick);
        }

        refreshUI();
    }
Ejemplo n.º 16
0
    /// <summary>
    /// 初始化数据
    /// </summary>
    private void initData()
    {
        if (mListStatus == null)
        {
            return;
        }
        Transform switchItem = CptUtil.getCptFormParentByName <Transform, Transform>(transform, "SwitchImage");
        Button    switchBT   = transform.GetComponent <Button>();

        if (switchItem == null)
        {
            return;
        }
        mListSwitchItem = new List <GameObject>();
        for (int i = 0; i < mListStatus.Count; i++)
        {
            GameObject itemObj = createSwitchImage(switchItem, i);
            mListSwitchItem.Add(itemObj);
        }
        Destroy(switchItem.gameObject);
        if (switchBT != null)
        {
            switchBT.onClick.AddListener(switchClick);
        }
    }
Ejemplo n.º 17
0
    private new void Awake()
    {
        base.Awake();

        //初始化标题栏
        mJigsawSelectTiltebar = CptUtil.getCptFormParentByName <Transform, Transform>(transform, "TitleBar");
        mTitleBarExitBT       = CptUtil.getCptFormParentByName <Transform, Button>(mJigsawSelectTiltebar, "ExitBT");
        if (mTitleBarExitBT != null)
        {
            mTitleBarExitBT.onClick.AddListener(addExitOnClick);
        }
        //初始化语言下拉
        mLanguageSelectionTitle    = CptUtil.getCptFormParentByName <Transform, Text>(transform, "LanguageSelectionTitle");
        mLanguageSelectionDropdown = CptUtil.getCptFormParentByName <Transform, Dropdown>(transform, "LanguageSelectionDropdown");

        //初始化BGM
        mMusicSelectionTitle = CptUtil.getCptFormParentByName <Transform, Text>(transform, "MusicSelectionTitle");
        mMusicSelectionSwith = CptUtil.getCptFormParentByName <Transform, SwitchButton>(transform, "MusicSelectionSwitch");
        //初始化音效
        mSoundSelectionTitle  = CptUtil.getCptFormParentByName <Transform, Text>(transform, "SoundSelectionTitle");
        mSoundSelectionSwitch = CptUtil.getCptFormParentByName <Transform, SwitchButton>(transform, "SoundSelectionSwitch");

        //初始化模式选择
        mScreenModeTitle    = CptUtil.getCptFormParentByName <Transform, Text>(transform, "ScreenModeTitle");
        mScreenModeDropdown = CptUtil.getCptFormParentByName <Transform, Dropdown>(transform, "ScreenModeDropdown");
        //初始化分辨率选择
        //mScreenResolutionTitle = CptUtil.getCptFormParentByName<Transform, Text>(transform, "ScreenResolutionTitle");
        //mScreenResolutionDropdown = CptUtil.getCptFormParentByName<Transform, Dropdown>(transform, "ScreenResolutionDropdown");

        musicSlider.onValueChanged.AddListener(musicSliderListener);
        soundSlider.onValueChanged.AddListener(soundSliderListener);

        refreshUI();
    }
Ejemplo n.º 18
0
    /// <summary>
    /// 携程-加载模型
    /// </summary>
    /// <param name="modelInfo"></param>
    /// <param name="userModelData"></param>
    /// <param name="action"></param>
    /// <returns></returns>
    public IEnumerator CoroutineForLoadModel(ModelInfoBean modelInfo, UserModelDataBean userModelData, Action action)
    {
        //读取模型
        ResourceRequest resourceRequest = Resources.LoadAsync("Model/" + modelInfo.model_name);

        yield return(resourceRequest);

        GameObject objModelTemp = resourceRequest.asset as GameObject;

        //移除场景中的模型
        CptUtil.RemoveChildsByActive(gameObject);
        //创建模型
        GameObject objModel = Instantiate(gameObject, objModelTemp);

        //初始化模型位置
        objModel.transform.position = Vector3.zero;
        //添加模型控件
        GameModelCpt gameModel = CptUtil.AddCpt <GameModelCpt>(objModel);

        gameModel.SetData(userModelData, modelInfo);
        //设置加载的模型
        currentLoadModel = gameModel;
        action?.Invoke();
        Resources.UnloadUnusedAssets();
    }
Ejemplo n.º 19
0
    /// <summary>
    /// 设置成就达成条件
    /// </summary>
    /// <param name="data"></param>
    public void SetAchieve(AchievementStatusEnum status, AchievementInfoBean data)
    {
        CptUtil.RemoveChildsByActive(objAchieveContent.transform);
        if (data == null)
        {
            return;
        }
        List <PreTypeBean> listPreData = PreTypeEnumTools.GetListPreData(data.pre_data);
        GameDataBean       gameData    = GameDataHandler.Instance.manager.GetGameData();

        foreach (var itemPreData in listPreData)
        {
            if (status == AchievementStatusEnum.Completed)
            {
                PreTypeEnumTools.GetPreDetails(itemPreData, gameData, true);
            }
            else
            {
                PreTypeEnumTools.GetPreDetails(itemPreData, gameData, false);
            }
            string preDes   = itemPreData.preDescribe;
            float  progress = itemPreData.progress;
            CreateAchieveItem(preDes, progress);
        }
    }
Ejemplo n.º 20
0
 public void InitData(GameDataBean gameData)
 {
     CptUtil.RemoveChildsByActive(objInnLevelContainer);
     this.gameData = gameData;
     Action<List<StoreInfoBean>> callBack = SetStoreData;
     StoreInfoHandler.Instance.manager.GetStoreInfoForGuildInnLevel(callBack);
 }
Ejemplo n.º 21
0
 protected override void Awake()
 {
     canvas           = CptUtil.AddCpt <Canvas>(gameObject);
     canvasScaler     = CptUtil.AddCpt <CanvasScaler>(gameObject);
     graphicRaycaster = CptUtil.AddCpt <GraphicRaycaster>(gameObject);
     ChangeUIRenderMode(RenderMode.ScreenSpaceOverlay);
 }
Ejemplo n.º 22
0
    private new void Awake()
    {
        base.Awake();

        startGameBT   = CptUtil.getCptFormParentByName <Canvas, Button>(mUICanvas, "StartGameBT");
        startGameText = CptUtil.getCptFormParentByName <Button, Text>(startGameBT, "StartGameText");

        customBT   = CptUtil.getCptFormParentByName <Canvas, Button>(mUICanvas, "CustomBT");
        customText = CptUtil.getCptFormParentByName <Button, Text>(customBT, "CustomText");

        settingBT   = CptUtil.getCptFormParentByName <Canvas, Button>(mUICanvas, "SettingBT");
        settingText = CptUtil.getCptFormParentByName <Button, Text>(settingBT, "SettingText");

        exitBT   = CptUtil.getCptFormParentByName <Canvas, Button>(mUICanvas, "ExitBT");
        exitText = CptUtil.getCptFormParentByName <Button, Text>(exitBT, "ExitText");

        workshopBT   = CptUtil.getCptFormParentByName <Canvas, Button>(mUICanvas, "WorkshopBT");
        workshopText = CptUtil.getCptFormParentByName <Button, Text>(workshopBT, "WorkshopText");

        mLogoTitle1   = CptUtil.getCptFormParentByName <Transform, Image>(transform, "LogoTitle1");
        mLogoTitle2   = CptUtil.getCptFormParentByName <Transform, Image>(transform, "LogoTitle2");
        mLogoTitleBT1 = CptUtil.getCptFormParentByName <Transform, Button>(transform, "LogoTitle1");
        mLogoTitleBT2 = CptUtil.getCptFormParentByName <Transform, Button>(transform, "LogoTitle2");

        startGameBT.onClick.AddListener(startGameOnClick);
        customBT.onClick.AddListener(customOnClick);
        settingBT.onClick.AddListener(settingOnClick);
        exitBT.onClick.AddListener(exitOnClick);
        workshopBT.onClick.AddListener(workshopOnClick);

        mLogoTitleBT1.onClick.AddListener(makerOnClick);
        mLogoTitleBT2.onClick.AddListener(makerOnClick);
        refreshUI();
    }
Ejemplo n.º 23
0
    private new void Awake()
    {
        base.Awake();
        gameTimerTF = CptUtil.getCptFormParentByName <Transform, Transform>(transform, "GameTimer");
        if (gameTimerTF != null)
        {
            gameTimerControlCpt = gameTimerTF.gameObject.AddComponent <GameTimerControlCpt>();
        }
        gameInfoBT  = CptUtil.getCptFormParentByName <Transform, Button>(transform, "GameInfoBT");
        gamePauseBT = CptUtil.getCptFormParentByName <Transform, Button>(transform, "GamePauseBT");
        gameOIBT    = CptUtil.getCptFormParentByName <Transform, Button>(transform, "GameOIBT");
        //   gameMusicBT = CptUtil.getCptFormParentByName<Transform, Button>(transform, "GameMusicBT");

        gameInfoBT.onClick.AddListener(openGameInfo);
        gamePauseBT.onClick.AddListener(openPauseBT);
        gameOIBT.onClick.AddListener(openOI);


        CanvasGroup timeUI = gameTimerTF.GetComponent <CanvasGroup>();

        if (CommonConfigure.IsOpenTimeUI == EnabledEnum.ON)
        {
            timeUI.alpha = 1;
        }
        else
        {
            timeUI.alpha = 0;
        }
        //  gameMusicBT.onClick.AddListener(openGameMusic);
    }
    private void InitTags()
    {
        if (tagsGroup == null)
        {
            return;
        }
        List <string> tags = new List <string>();

        tags.Add("other");
        tags.Add("painting");
        tags.Add("anime");
        tags.Add("life");
        tags.Add("movie");
        tags.Add("people");
        tags.Add("animal");
        tags.Add("scenery");
        tags.Add("starrysky");
        tags.Add("food");
        tags.Add("game");
        tags.Add("celebrity");
        listTag = new List <Toggle>();
        for (int i = 0; i < tags.Count; i++)
        {
            GameObject tagObj = Instantiate(tagModel);
            tagObj.name = tags[i];
            tagObj.SetActive(true);
            tagObj.transform.parent     = tagsGroup.transform;
            tagObj.transform.localScale = new Vector3(1f, 1f, 1f);
            Text tagText = CptUtil.getCptFormParentByName <Transform, Text>(tagObj.transform, "Label");
            tagText.text = tags[i];
            listTag.Add(tagObj.GetComponent <Toggle>());
        }
    }
Ejemplo n.º 25
0
    public void SetData(UserModelDataBean userModelData, ModelInfoBean modelInfo)
    {
        if (modelInfo == null)
        {
            return;
        }
        if (userModelData == null)
        {
            return;
        }
        dissolveAmountId = Shader.PropertyToID(m_DissolveAmount);
        mapMaterialForModel.Clear();
        Texture textureDisolveGuide = Resources.Load("Texture/noise_1") as Texture;

        if (!CheckUtil.ListIsNull(modelInfo.listPartData))
        {
            for (int i = 0; i < modelInfo.listPartData.Count; i++)
            {
                ModelPartInfoBean partInfo     = modelInfo.listPartData[i];
                Renderer          itemRenderer = CptUtil.GetCptInChildrenByName <Renderer>(gameObject, partInfo.part_name);
                //获取所有的Material
                List <Material> listMaterial = new List <Material>();
                itemRenderer.GetMaterials(listMaterial);
                //获取用户进度
                UserModelPartDataBean userModelPartData = userModelData.GetUserPartDataById(partInfo.id);
                float pro = 0;
                if (userModelPartData != null)
                {
                    pro = userModelPartData.GetProgress(partInfo.max_level);
                }
                //重新设置所有的shader
                foreach (Material itemMaterial in listMaterial)
                {
                    Texture itemTexture = itemMaterial.GetTexture("_MainTex");
                    if (itemTexture)
                    {
                        itemMaterial.shader = Shader.Find("ASESampleShaders/Community/DissolveBurnWithFire");
                        itemMaterial.SetTexture("_Albedo", itemTexture);
                        itemMaterial.SetTexture("_Normal", itemTexture);
                        itemMaterial.SetTexture("_BurnRamp", itemTexture);
                        itemMaterial.SetFloat("_MaskClipValue", 0.5f);
                    }
                    else
                    {
                        Color color = itemMaterial.GetColor("_Color");
                        itemMaterial.shader = Shader.Find("ASESampleShaders/Community/DissolveBurn_01");
                        itemMaterial.SetFloat("_Cutoff", 0.5f);
                        itemMaterial.SetColor("_MainColor", color);
                    }
                    itemMaterial.SetTexture("_DisolveGuide", textureDisolveGuide);
                    itemMaterial.SetFloat(dissolveAmountId, 1 - pro);
                }
                if (!mapMaterialForModel.ContainsKey(partInfo.part_name))
                {
                    mapMaterialForModel.Add(partInfo.part_name, listMaterial);
                }
            }
        }
    }
Ejemplo n.º 26
0
    /// <summary>
    /// 设置数据
    /// </summary>
    /// <param name="waiterData"></param>
    public void SetData(CharacterBean characterData)
    {
        this.characterData = characterData;
        CptUtil.RemoveChildsByActive(objItemContent);
        AddWorkDays(characterData.baseInfo.workDay);

        AddDazeNumber(characterData.baseInfo.dazeNumber);
    }
Ejemplo n.º 27
0
 public void SetData(CharacterWorkerForChefBean chefData)
 {
     this.chefData = chefData;
     CptUtil.RemoveChildsByName(objItemContent.transform, "Item", true);
     AddCookNumber(chefData.cookNumber);
     //AddCookTime(chefData.cookTime);
     AddFoodData(chefData.listFoodCookNumer);
 }
Ejemplo n.º 28
0
    /// <summary>
    /// 加载toast容器
    /// </summary>
    public void LoadToastListContainer()
    {
        //加载Toast容器
        GameObject toastListModel = LoadResourcesUtil.SyncLoadData <GameObject>("UI/ToastList");
        GameObject objToastList   = Instantiate(gameObject, toastListModel);

        objToastContainer = CptUtil.GetCptInChildrenByName <Transform>(objToastList, "Container").gameObject;
    }
Ejemplo n.º 29
0
    public void InitData()
    {
        StopAllCoroutines();
        CptUtil.RemoveChildsByActive(objMenuContainer);
        Dictionary <long, MenuInfoBean> listMenu = InnFoodHandler.Instance.manager.listMenuData;

        StartCoroutine(CoroutineForCreateMenuList(listMenu));
    }
Ejemplo n.º 30
0
    private void Awake()
    {
        aiForCharacterPath = CptUtil.AddCpt <AIForCharacterPathAuto>(gameObject);
        characterAnim      = GetComponent <CharacterAnimCpt>();

        AutoLinkHandler();
        ReflexUtil.AutoLinkDataForChild(this, "transform_");
    }