Ejemplo n.º 1
0
        /// <summary>
        /// 更新指定页面的已学习单词
        /// </summary>
        public void UpdateWordsOfCurrentPage(List <HLHWord> words, int currentPageIndex, int totalPage)
        {
            wordPool.AddChildInstancesToPool(wordContainer);

            int minWordIndexOfCurrentPage = currentPageIndex * CommonData.singleWordsRecordsPageVolume;
            int maxWordIndexOfCurrentPage = (currentPageIndex + 1) * CommonData.singleWordsRecordsPageVolume - 1;

            maxWordIndexOfCurrentPage = maxWordIndexOfCurrentPage > words.Count ? words.Count : maxWordIndexOfCurrentPage;

            for (int i = 0; i < words.Count; i++)
            {
                HLHWord word = words[i];

                WordItemView wordItem = wordPool.GetInstance <WordItemView>(wordModel.gameObject, wordContainer);

                int indexInCurrentPage = i;

                wordItem.InitWordItemView(ShowChangeWordStatusQueruHUD, delegate {
                    ShowWordDetail(word, minWordIndexOfCurrentPage + indexInCurrentPage);
                }, wordPool);
                wordItem.SetUpCellDetailView(word);
            }

            generalInfoPlane.gameObject.SetActive(false);
            wordsPlane.gameObject.SetActive(true);

            wordPageText.text = string.Format("{0}/{1}", currentPageIndex + 1, totalPage);

            GetComponent <Canvas>().enabled = true;
        }
        private void UpdateGoodsDisplay()
        {
            goodsPool.AddChildInstancesToPool(goodsContainer);

            List <HLHNPCGoods> itemsAsGoods = npc.GetCurrentLevelGoods();

            for (int i = 0; i < itemsAsGoods.Count; i++)
            {
                HLHNPCGoods goods = itemsAsGoods[i];

                Transform goodsCell = goodsPool.GetInstance <Transform>(goodsModel.gameObject, goodsContainer);

                Item itemAsGoods = goods.GetGoodsItem();

                goodsCell.GetComponent <GoodsCell>().SetUpGoodsCell(goods);

                goodsCell.GetComponent <Button>().onClick.RemoveAllListeners();

                int goodsIndex = i;

                goodsCell.GetComponent <Button>().onClick.AddListener(delegate {
                    currentSelectedItem    = itemAsGoods;
                    currentSelectItemPrice = goods.GetGoodsPrice();
                    itemDetail.SetUpItemDetail(itemAsGoods, currentSelectItemPrice, ItemOperationType.Buy);
                    UpdateGoodsSelection(goodsIndex);
                    currentSelectGoodsIndex = goodsIndex;
                    bagItemsDisplay.HideAllItemSelectedTintIcon();
                });
            }
        }
        /// <summary>
        /// 退出战斗时重用物体进缓存池
        /// </summary>
        public override void QuitFightPlane()
        {
            for (int i = 0; i < activeSkillButtonContainer.childCount; i++)
            {
                activeSkillButtonContainer.GetChild(i).GetComponent <ActiveSkillButton>().Reset();
            }

            activeSkillButtonPool.AddChildInstancesToPool(activeSkillButtonContainer);
        }
        public void SetUpDialogPlane(Dialog dialog)
        {
            dialogText.text = dialog.dialog;

            choiceButtonPool.AddChildInstancesToPool(choiceContainer);

            bool showNextButton = true;

            List <Choice> choices = dialog.choices;

            for (int i = 0; i < choices.Count; i++)
            {
                Choice choice = choices [i];

                if (choice.choice == string.Empty)
                {
                    continue;
                }

                showNextButton = false;

//				Button choiceButton = Instantiate (choiceButtonModel.gameObject).GetComponent<Button> ();
//				choiceButton.transform.SetParent (choiceContainer);


                Button choiceButton = choiceButtonPool.GetInstance <Button> (choiceButtonModel.gameObject, choiceContainer);

                choiceButton.GetComponentInChildren <Text> ().text = choice.choice;

                choiceButton.onClick.RemoveAllListeners();

                choiceButton.onClick.AddListener(delegate() {
                    MakeChoice(choice);
                });
            }

            nextDialogButton.gameObject.SetActive(showNextButton);

            if (dialog.rewardIds.Length != 0)
            {
                for (int i = 0; i < dialog.rewardIds.Length; i++)
                {
                    Item rewardItem = Item.NewItemWith(dialog.rewardIds [i], dialog.rewardCounts [i]);
                    Player.mainPlayer.AddItem(rewardItem);
                    dialog.finishRewarding = true;
                    string tint = string.Format("获得 {0} x{1}", rewardItem.itemName, rewardItem.itemCount);

                    Sprite rewardSprite = GameManager.Instance.gameDataCenter.allItemSprites.Find(delegate(Sprite obj) {
                        return(obj.name == rewardItem.spriteName);
                    });

                    tintHUD.SetUpTintHUD(tint, rewardSprite);
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 初始化背包物品显示界面
        /// </summary>
        public void SetUpBagItemsPlane(int bagIndex)
        {
            currentBagIndex = bagIndex;

            // 将所有的背包物品先放回缓存池中,等待接下来更新背包界面的时候再使用
            bagItemsPool.AddChildInstancesToPool(bagItemsContainer);

            // 更新所有背包切换按钮的显示状态
            for (int i = 0; i < bagTabs.Length; i++)
            {
                if (i == bagIndex)
                {
                    if (i != 4)
                    {
                        bagTabs[i].GetComponentInChildren <Text>().color = CommonData.tabBarTitleSelectedColor;
                    }
                    else
                    {
                        bagTabs[i].transform.Find("EquipmentIcon").GetComponent <Image>().color = CommonData.tabBarTitleSelectedColor;
                    }
                }
                else
                {
                    if (i != 4)
                    {
                        bagTabs[i].GetComponentInChildren <Text>().color = CommonData.tabBarTitleNormalColor;
                    }
                    else
                    {
                        bagTabs[i].transform.Find("EquipmentIcon").GetComponent <Image>().color = Color.white;
                    }
                }
            }


            if (Player.mainPlayer.allItemsInBag.Count <= minItemIndexOfCurrentBag)
            {
                return;
            }

            for (int i = minItemIndexOfCurrentBag; i <= maxItemIndexOfCurrentBag; i++)
            {
                if (i >= Player.mainPlayer.allItemsInBag.Count)
                {
                    return;
                }
                AddBagItem(Player.mainPlayer.allItemsInBag[i]);
            }
        }
        /// <summary>
        /// 初始化所有消耗品显示界面
        /// </summary>
        public void SetUpConsumablesInBagPlane()
        {
            UpdatePageButtonStatus();

            consumablesButtonPool.AddChildInstancesToPool(consumablesInBagContainer);

            if (player.allConsumablesInBag.Count <= equipedConsumablesButtons.Length)
            {
                return;
            }

            int firstIndexOfCurrentPage = equipedConsumablesButtons.Length + currentConsumablesPage * consumablesCountInOnePage;

            int firstIndexOfNextPage = firstIndexOfCurrentPage + consumablesCountInOnePage;

            int endIndexOfConsumablesInCurrentPage = player.allConsumablesInBag.Count < firstIndexOfNextPage ? player.allConsumablesInBag.Count - 1 : firstIndexOfNextPage - 1;

            for (int i = firstIndexOfCurrentPage; i <= endIndexOfConsumablesInCurrentPage; i++)
            {
                Consumables consumables = Player.mainPlayer.allConsumablesInBag [i];

                Button consumablesButton = consumablesButtonPool.GetInstance <Button> (consumablesButtonModel.gameObject, consumablesInBagContainer);

                consumablesButton.GetComponent <ConsumablesInBagCell> ().SetUpConsumablesInBagCell(consumables);
            }
        }
Ejemplo n.º 7
0
        public void RefreshSpell()
        {
            spellText.text = string.Empty;

            //string spell = spellItem.spell;

            playerSpell = new StringBuilder();

            characterPool.AddChildInstancesToPool(characterContainer);

            for (int i = 0; i < Player.mainPlayer.allCollectedCharacters.Count; i++)
            {
                char character = Player.mainPlayer.allCollectedCharacters[i];

                Button characterButton = characterPool.GetInstance <Button>(characterModel.gameObject, characterContainer);

                characterButton.GetComponentInChildren <Text>().text = character.ToString();

                characterButton.onClick.RemoveAllListeners();

                characterButton.onClick.AddListener(delegate
                {
                    characterPool.AddInstanceToPool(characterButton.gameObject);

                    playerSpell.Append(character.ToString());

                    spellText.text = playerSpell.ToString();
                });
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 初始化已学习页
        /// </summary>
        /// <param name="learnInfo">Learn info.</param>
//		public void SetUpAllLearnedWords(){
//
//			wordsPlane.gameObject.SetActive (true);
//
//			List<LearnWord> allLearnedWords = learnInfo.GetAllLearnedWords ();
//
//			for (int i = 0; i < allLearnedWords.Count; i++) {
//
//				LearnWord word = allLearnedWords [i];
//
//				Transform wordItem = wordPool.GetInstance <Transform> (wordModel.gameObject, wordContainer);
//
//				wordItem.GetComponent<WordItemView> ().SetUpCellDetailView (word);
//
//			}
//
//		}

        /// <summary>
        /// 初始化未学习页
        /// </summary>
        /// <param name="learnInfo">Learn info.</param>
        public void SetUpAllUngraspedWords()
        {
            List <LearnWord> allUngraspedWords = learnInfo.GetAllUngraspedWords();

            wordPool.AddChildInstancesToPool(wordContainer);

            for (int i = 0; i < allUngraspedWords.Count; i++)
            {
                LearnWord word = allUngraspedWords [i];

                Transform wordItem = wordPool.GetInstance <Transform> (wordModel.gameObject, wordContainer);

                wordItem.GetComponent <WordItemView> ().SetUpCellDetailView(word);
            }

            generalInfoPlane.gameObject.SetActive(false);
            wordsPlane.gameObject.SetActive(true);

            wrongWordsTitle.GetComponent <Image> ().sprite        = selectedSprite;
            wrongWordsTitle.GetComponentInChildren <Text>().color = new Color(
                CommonData.selectedColor.x,
                CommonData.selectedColor.y,
                CommonData.selectedColor.z);
            recordTitle.GetComponent <Image> ().sprite        = normalSprite;
            recordTitle.GetComponentInChildren <Text>().color = new Color(
                CommonData.deselectedColor.x,
                CommonData.deselectedColor.y,
                CommonData.deselectedColor.z);

            GetComponent <Canvas> ().enabled = true;
        }
Ejemplo n.º 9
0
        public void SetUpSkillLearningView(HLHNPC npc, CallBack quitCallBack)
        {
            this.currentNpc = npc;

            GameManager.Instance.soundManager.PlayAudioClip(CommonData.merchantAudioName);

            gameObject.SetActive(true);

            this.skillGoodsIds = npc.npcSkillIds;

            this.quitCallBack = quitCallBack;

            skillGoodsPool.AddChildInstancesToPool(skillGoodsContainer);

            for (int i = 0; i < skillGoodsIds.Count; i++)
            {
                SkillGoodsInTrade skillGoodsDetail = skillGoodsPool.GetInstance <SkillGoodsInTrade>(skillGoodsModel.gameObject, skillGoodsContainer);

                Skill skill = GameManager.Instance.gameDataCenter.allSkills.Find(delegate(Skill obj)
                {
                    return(obj.skillId == skillGoodsIds[i]);
                });

                skillGoodsDetail.SetupSkillDetailInNPC(skill, SkillGoodsSelectCallBack);

                skillGoodsDetail.SetUpSelectedIcon(false);

                allSkillGoods.Add(skillGoodsDetail);
            }

            skillNumLeftText.text = string.Format("剩余技能点: {0}", Player.mainPlayer.skillNumLeft);

            for (int i = 0; i < allLearnedSkillDetails.Length; i++)
            {
                SimpleSkillDetail learnedSkillDetail = allLearnedSkillDetails[i];

                if (i < Player.mainPlayer.allLearnedSkills.Count)
                {
                    Skill learnedSkill = Player.mainPlayer.allLearnedSkills[i];

                    learnedSkillDetail.SetUpSimpleSkillDetail(learnedSkill, LearnedSkillSelectCallBack);
                }
                else
                {
                    learnedSkillDetail.ClearSimpleSkillDetail();
                }

                learnedSkillDetail.SetUpSelectedIcon(false);
            }

            //skillDetailInTrade.InitskilldetailInTrade(UpdateLearnedSkillsPlane);
            skillDetailInTrade.ClearSkillDetailInTrade();

            EnterSkillGoodsTradeViewDisplay();
        }
Ejemplo n.º 10
0
        // 初始化npc界面
        public void SetUpNPCView(HLHNPC npc)
        {
            this.npc = npc;

            npcName.text = npc.npcName;

            // 随机npc的问候语序号
            int randomSeed = Random.Range(0, npc.regularGreetings.Count);

            // 获取npc的问候语
            HLHDialog greeting = npc.regularGreetings[randomSeed];

            dialogText.text = greeting.dialogContent;

            // npc交互主界面上的选项卡先全都放入缓存池
            choiceButtonPool.AddChildInstancesToPool(choiceButtonContainer);

            // 有交谈功能的话添加一个交谈选项卡
            if (npc.isChatTriggered)
            {
                AddChoice("交谈", SetUpDialogPlane);
            }
            // 有交易功能的话添加一个交易选项卡
            if (npc.isTradeTriggered)
            {
                AddChoice("交易", SetUpTrade);
            }
            // 有传送功能的话添加一个传送选项卡
            if (npc.isTransportTriggered)
            {
                AddChoice("传送", SetUpTransportLevelSelectView);
            }
            // 有学习技能功能的话添加一个学习技能选项卡
            if (npc.isLearnSkillTriggered)
            {
                AddChoice("学习技能", SetupSkillLearningPlane);
            }
            // 有镶嵌宝石功能的话添加一个镶嵌宝石选项卡
            if (npc.isAddGemStoneTriggered)
            {
                AddChoice("镶嵌宝石", SetUpSpecialOperation);
            }

            // 添加离开选项卡
            AddChoice("离开", QuitNPCPlane);

            // 显示探索场景顶部遮罩【由于npc画布高于探索画布,且正常显示范围在顶部bar以下,所以只在npc画布上设置遮罩会导致探索界面中顶部有部分区域是高亮的】
            ExploreManager.Instance.expUICtr.ShowTopBarMask();


            GetComponent <Canvas>().enabled = true;

            mainNPCView.gameObject.SetActive(true);
        }
Ejemplo n.º 11
0
        public void SetUpTradePlane()
        {
            SoundManager.Instance.PlayAudioClip("UI/sfx_UI_Trader");

            ClearItemDetail();

            Trader trader = currentEnteredNpc as Trader;

            currentEnteredNpc = trader;

            tradePlane.gameObject.SetActive(true);

            goodsPool.AddChildInstancesToPool(goodsContainer);

            List <Item> itemsAsGoods = trader.itemsAsGoodsOfCurrentLevel;

            for (int i = 0; i < itemsAsGoods.Count; i++)
            {
                Item itemAsGoods = itemsAsGoods [i];

//				Transform goodsCell = Instantiate (goodsModel.gameObject).transform;
//				goodsCell.SetParent (goodsContainer);
                Transform goodsCell = goodsPool.GetInstance <Transform> (goodsModel.gameObject, goodsContainer);

                goodsCell.GetComponent <GoodsCell> ().SetUpGoodsCell(itemAsGoods);

                goodsCell.GetComponent <Button>().onClick.RemoveAllListeners();

                int goodsIndex = i;

                goodsCell.GetComponent <Button>().onClick.AddListener(delegate {
                    currentSelectedItem = itemAsGoods;
                    SetUpItemDetailsInTrade(itemAsGoods);
                    UpdateGoodsSelection(goodsIndex);
                });
            }
        }
Ejemplo n.º 12
0
        public void QuitWordHUD()
        {
            if (quitCallBack != null)
            {
                quitCallBack(questionWord);
            }

            characterToFillCellPool.AddChildInstancesToPool(characterToFillCellContainer);

            questionWord = null;

            recordList.Clear();

            gameObject.SetActive(false);
        }
        protected void UpdateSkillStatusPlane(Agent agent)
        {
            statusTintPool.AddChildInstancesToPool(statusTintContainer);

            for (int i = 0; i < agent.allStatus.Count; i++)
            {
                string status     = agent.allStatus [i];
                Image  statusTint = statusTintPool.GetInstance <Image> (statusTintModel.gameObject, statusTintContainer);

                Sprite sprite = GameManager.Instance.gameDataCenter.allSkillSprites.Find(delegate(Sprite obj) {
                    return(obj.name == status);
                });

                statusTint.sprite  = sprite;
                statusTint.enabled = sprite != null;
            }
        }
        public void SetUpUnlockedItemsView(UnlockScrollType unlockScrollType)
        {
            switch (unlockScrollType)
            {
            case UnlockScrollType.Equipment:
                unlockEquipmentTitle.GetComponent <Image> ().sprite         = selectedSprite;
                unlockEquipmentTitle.GetComponentInChildren <Text> ().color = new Color(
                    CommonData.selectedColor.x,
                    CommonData.selectedColor.y,
                    CommonData.selectedColor.z);
                unlockConsumablesTitle.GetComponent <Image> ().sprite        = normalSprite;
                unlockConsumablesTitle.GetComponentInChildren <Text>().color = new Color(
                    CommonData.deselectedColor.x,
                    CommonData.deselectedColor.y,
                    CommonData.deselectedColor.z);
                break;

            case UnlockScrollType.Consumables:
                unlockConsumablesTitle.GetComponent <Image> ().sprite         = selectedSprite;
                unlockConsumablesTitle.GetComponentInChildren <Text> ().color = new Color(
                    CommonData.selectedColor.x,
                    CommonData.selectedColor.y,
                    CommonData.selectedColor.z);
                unlockEquipmentTitle.GetComponent <Image> ().sprite        = normalSprite;
                unlockEquipmentTitle.GetComponentInChildren <Text>().color = new Color(
                    CommonData.deselectedColor.x,
                    CommonData.deselectedColor.y,
                    CommonData.deselectedColor.z);
                break;
            }

            unlockedItemsPool.AddChildInstancesToPool(unlockedItemsContainer);

            for (int i = 0; i < Player.mainPlayer.allUnlockScrollsInBag.Count; i++)
            {
                UnlockScroll unlockScroll = Player.mainPlayer.allUnlockScrollsInBag [i];
                if (unlockScroll.unlocked && unlockScroll.unlockScrollType == unlockScrollType)
                {
                    Transform unlockedItem = unlockedItemsPool.GetInstance <Transform> (unlockedItemModel.gameObject, unlockedItemsContainer);
                    SetUpUnlockedItem(unlockedItem, unlockScroll);
                }
            }

            GetComponent <Canvas> ().enabled = true;
        }
Ejemplo n.º 15
0
        public void QuitKeyDoorOperatorView()
        {
            toolButtonPool.AddChildInstancesToPool(toolButtonContainer);

            keyDoorCharacterPool.AddChildInstancesToPool(keyDoorCharacterContainer);

            this.gameObject.SetActive(false);

            toolSelectPlane.gameObject.SetActive(false);

            unlockOperationPlane.gameObject.SetActive(false);

            queryQuitHUD.gameObject.SetActive(false);

            ExploreManager.Instance.battlePlayerCtr.isInEvent = false;


            ExploreManager.Instance.MapWalkableEventsStartAction();
        }
Ejemplo n.º 16
0
        public void SetUpScrollView()
        {
            cellPool.AddChildInstancesToPool(scrollContentContainer);

            scrollContentContainer.localPosition = new Vector3(scrollContentContainer.localPosition.x, 0, 0);

            //如果当前选中类的所有装备数量小于预加载数量,则只加载实际装备数量的cell
            int maxCount = maxCellsVisible < allDataList.Count ? maxCellsVisible : allDataList.Count;

            for (int i = 0; i < maxCount; i++)
            {
                object data = allDataList[i];

                Transform itemDetail = cellPool.GetInstance <Transform> (cellModel.gameObject, scrollContentContainer);

                itemDetail.GetComponent <ItemDetailView> ().SetUpCellDetailView(allDataList [i]);
            }

            //初始化当前顶部和底部的equipment序号
            currentMinCellIndex = 0;
            currentMaxCellIndex = maxCount < 1 ? 0 : maxCount - 1;
        }
Ejemplo n.º 17
0
        /// <summary>
        /// 初始化背包物品界面
        /// </summary>
        public void SetUpBagItemsPlane(int bagIndex)
        {
            currentBagIndex = bagIndex;

            bagItemsPool.AddChildInstancesToPool(bagItemsContainer);

            if (player.allItemsInBag.Count <= minItemIndexOfCurrentBag)
            {
                return;
            }



            for (int i = minItemIndexOfCurrentBag; i <= maxItemIndexOfCurrentBag; i++)
            {
                if (i >= player.allItemsInBag.Count)
                {
                    return;
                }
                AddBagItem(player.allItemsInBag[i]);
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 初始化通关记录界面【初始化UI】
        /// </summary>
        /// <param name="pageIndex">Page index.</param>
        /// <param name="maxPageIndex">Max page index.</param>
        /// <param name="minRecordIndex">Minimum record index.</param>
        /// <param name="maxRecordIndex">Max record index.</param>
        public void SetUpPlayerRecordView(int pageIndex, int maxPageIndex, int minRecordIndex, int maxRecordIndex)
        {
            if (playRecords == null || playRecords.Count == 0)
            {
                noDataHintText.enabled = true;
                nextPageButton.gameObject.SetActive(false);
                lastPageButton.gameObject.SetActive(false);
                pageText.enabled = false;
                return;
            }

            noDataHintText.enabled = false;
            nextPageButton.gameObject.SetActive(true);
            lastPageButton.gameObject.SetActive(true);
            pageText.enabled = true;

            pageText.text = string.Format("{0} / {1}", pageIndex + 1, maxPageIndex + 1);

            simpleRecordCellPool.AddChildInstancesToPool(simpleRecordCellContainer);

            for (int i = minRecordIndex; i <= maxRecordIndex; i++)
            {
                if (i < 0 || i >= playRecords.Count)
                {
                    continue;
                }

                PlayRecord           playRecord           = playRecords[i];
                PlayRecordSimpleCell playRecordSimpleCell = simpleRecordCellPool.GetInstance <PlayRecordSimpleCell>(simpleCellModel.gameObject, simpleRecordCellContainer);

                int recordIndex = i;

                playRecordSimpleCell.SetUpPlayRecordSimpleCell(playRecord, recordIndex, delegate
                {
                    playRecordDetailHUD.SetUpPlayRecordDetailHUD(playRecord);
                });
            }
        }
        public void SetUpCharactersHUD()
        {
            SoundManager.Instance.PlayAudioClip("UI/sfx_UI_Paper");

            characterPool.AddChildInstancesToPool(charactersContainer);

            for (int i = 0; i < Player.mainPlayer.charactersCount.Length; i++)
            {
                int count = Player.mainPlayer.charactersCount [i];

                if (count > 0)
                {
                    AddCharacterToPaper((char)(i + CommonData.aInASCII), count);
                }
            }

            charactersDisplayContainer.transform.localScale = new Vector3(0.1f, 0.1f, 1);

            gameObject.SetActive(true);

            zoomInCoroutine = CharactersHUDZoomIn();

            StartCoroutine(zoomInCoroutine);
        }
Ejemplo n.º 20
0
        public void SetUpLevelTransportView(HLHNPC npc, LevelTransportSelectCallBack levelSelectCallBack, CallBack quitCallBack)
        {
            this.levelSelectCallBack = levelSelectCallBack;
            this.quitCallBack        = quitCallBack;

            this.gameObject.SetActive(true);

            List <int> validTravelLevelIds = npc.GetValidTravelLevelIds();

            levelChoiceContainer.localPosition = Vector3.zero;

            levelChoicePool.AddChildInstancesToPool(levelChoiceContainer);

            bool hasValidTranportLevel = validTravelLevelIds.Count > 0;

            for (int i = 0; i < validTravelLevelIds.Count; i++)
            {
                int transportLevel = validTravelLevelIds[i];

                Button levelChoice = levelChoicePool.GetInstance <Button>(levelChoiceModel.gameObject, levelChoiceContainer);

                levelChoice.GetComponentInChildren <Text>().text = string.Format("第{0}层", transportLevel + 1);

                levelChoice.onClick.RemoveAllListeners();

                levelChoice.onClick.AddListener(delegate
                {
                    if (Player.mainPlayer.totalGold < transportCost)
                    {
                        tintHUD.SetUpSingleTextTintHUD("金币不足");
                        return;
                    }

                    Player.mainPlayer.totalGold -= transportCost;

                    GameManager.Instance.gameDataCenter.currentMapEventsRecord.Reset();
                    GameManager.Instance.persistDataManager.ClearCurrentMapWordsRecordAndSave();

                    if (levelSelectCallBack != null)
                    {
                        levelSelectCallBack(transportLevel);
                    }

                    this.gameObject.SetActive(false);
                });
            }


            noValidLevelHint.enabled = !hasValidTranportLevel;
            //upButton.gameObject.SetActive(hasValidTranportLevel);
            //downButton.gameObject.SetActive(hasValidTranportLevel);

            if (zoomCoroutine != null)
            {
                StopCoroutine(zoomCoroutine);
            }

            zoomCoroutine = HUDZoomIn();

            StartCoroutine(zoomCoroutine);
        }
Ejemplo n.º 21
0
        private void ToolSelectCallBack(Item tool)
        {
            SpecialItem key = tool as SpecialItem;


            bool needEnterUnlockOperator = true;

            hintIndexList.Clear();
            int        hintCount = 0;
            List <int> allIndex  = new List <int>();

            for (int i = 0; i < keyDoorWord.wordLength; i++)
            {
                allIndex.Add(i);
            }

            switch (key.specialItemType)
            {
            case SpecialItemType.TieYaoShi:
                hintCount      = 1;
                keyIcon.sprite = ironKeySprite;
                hintText.text  = "铁钥匙可提示一个字母";
                break;

            case SpecialItemType.TongYaoShi:
                hintCount      = 2;
                keyIcon.sprite = brassKeySprite;
                hintText.text  = "铜钥匙可提示两个字母";
                break;

            case SpecialItemType.JinYaoShi:
                keyIcon.sprite = goldKeySprite;
                hintText.text  = "金钥匙可提示三个字母";
                hintCount      = 3;
                break;

            case SpecialItemType.WanNengYaoShi:
                unlockSuccessCallBack(null);
                needEnterUnlockOperator = false;
                QuitKeyDoorOperatorView();
                break;

            case SpecialItemType.QiaoZhen:
                unlockSuccessCallBack(null);
                needEnterUnlockOperator = false;
                QuitKeyDoorOperatorView();
                break;
            }

            Player.mainPlayer.RemoveItem(key, 1);

            if (needEnterUnlockOperator)
            {
                toolButtonPool.AddChildInstancesToPool(toolButtonContainer);

                char[] characters = keyDoorWord.spell.ToCharArray();

                for (int i = 0; i < hintCount; i++)
                {
                    int randomSeed = Random.Range(0, allIndex.Count);

                    int index = allIndex[randomSeed];

                    hintIndexList.Add(index);

                    char character = characters[index];

                    SetCharacterAsHint(character, index);

                    allIndex.RemoveAt(randomSeed);
                }

                unlockOperationPlane.gameObject.SetActive(true);
                toolSelectPlane.gameObject.SetActive(false);
            }
        }
Ejemplo n.º 22
0
 private void CallBackOnQuitMonsterDisplay(Transform trans)
 {
     ExploreManager.Instance.battlePlayerCtr.isInEvent = false;
     ExploreManager.Instance.MapWalkableEventsStartAction();
     monsterUIPool.AddChildInstancesToPool(trans);
 }
Ejemplo n.º 23
0
//		private float GetMiddleLineWidth(int itemCount){
//
//			HorizontalLayoutGroup layout = recipesItemsContainer.GetComponent<HorizontalLayoutGroup> ();
//
//			float recipesItemWidth = recipesItemModel.GetComponent<RectTransform> ().rect.width;
//
//			return (itemCount - 1) * (layout.spacing + recipesItemWidth);
//
//		}

        private void SetUpRecipesItems(ItemModel.ItemInfoForProduce[] itemInfosForProduce)
        {
//			int horizontalFix = itemInfosForProduce.Length % 2 == 0 ? spacingX : 0;


            int spaceX = widthX / (itemInfosForProduce.Length > 1 ? itemInfosForProduce.Length - 1 : 1);

            recipesItemPool.AddChildInstancesToPool(recipesItemsContainer);

            bool canCraft = true;

            for (int i = 0; i < itemInfosForProduce.Length; i++)
            {
                ItemModel item = GameManager.Instance.gameDataCenter.allItemModels.Find(delegate(ItemModel obj) {
                    return(obj.itemId == itemInfosForProduce [i].itemId);
                });

                int itemCountForProduce = itemInfosForProduce [i].itemCount;

                Transform recipesItem = recipesItemPool.GetInstance <Transform> (recipesItemModel.gameObject, recipesItemsContainer);

                int localPosX = i * spaceX;

                recipesItem.localPosition = new Vector3(localPosX, 0, 0);

                Debug.Log(recipesItem.localPosition);

                Image recipesItemIcon       = recipesItem.Find("ItemIcon").GetComponent <Image> ();
                Text  recipesItemName       = recipesItem.Find("ItemName").GetComponent <Text> ();
                Text  recipesItemEnoughText = recipesItem.Find("ItemEnoughText").GetComponent <Text> ();

                Sprite itemSprite = GameManager.Instance.gameDataCenter.allItemSprites.Find(delegate(Sprite obj) {
                    return(obj.name == item.spriteName);
                });

                recipesItemIcon.sprite = itemSprite;

                recipesItemIcon.enabled = itemSprite != null;

                recipesItemName.text = item.itemName;

                int itemInBagCount = 0;

                List <Item> sameItemsInBag = Player.mainPlayer.allItemsInBag.FindAll(delegate(Item obj) {
                    return(obj.itemId == item.itemId);
                });

                for (int j = 0; j < Player.mainPlayer.allEquipedEquipments.Length; j++)
                {
                    if (Player.mainPlayer.allEquipedEquipments [j].itemId == item.itemId)
                    {
                        itemInBagCount++;
                    }
                }



                for (int j = 0; j < sameItemsInBag.Count; j++)
                {
                    itemInBagCount += sameItemsInBag [j].itemCount;
                }


                bool recipeItemEnough = itemInBagCount >= itemCountForProduce;

                canCraft = canCraft && recipeItemEnough;

                string color = recipeItemEnough ? "green" : "red";

                recipesItemEnoughText.text = string.Format("<color={0}>{1}/{2}</color>", color, itemInBagCount, itemCountForProduce);
            }

            craftButton.interactable = canCraft;
        }
Ejemplo n.º 24
0
 public void ClearCharacterFragments()
 {
     characterFragmentPool.AddChildInstancesToPool(characterFragmentsContainer);
 }