Exemple #1
0
    public void AddButtons(List <Item> currList)
    {
        int        i       = 0;
        GameObject thisRow = null;

        //goes through the list and finds out how many items we have,
        //add buttons as needed for each of the items
        //and then call the setup function in sampleButton
        foreach (Item currItem in currList)
        {
            //Debug.Log (currItem.itemName);
            if (i % 2 == 0)
            {
                //Debug.Log ("making column");
                GameObject newRow = RowObjectPool.GetObject();
                newRow.transform.SetParent(contentPanel, false);

                thisRow = newRow;
            }
            GameObject newButton = buttonObjectPool.GetObject();
            newButton.transform.SetParent(thisRow.transform, false);
            SampleButton sampleButton = newButton.GetComponent <SampleButton> ();
            sampleButton.Setup(currItem, this, this.control);
            i++;
        }
        //If there is a remainder
        if (i % 2 == 1)
        {
            GameObject newButton = buttonObjectPool.GetObject();
            newButton.transform.SetParent(thisRow.transform, false);
            newButton.GetComponent <Button> ().enabled = false;
            foreach (Transform child in newButton.GetComponentsInChildren <Transform>())
            {
                if (child.gameObject != newButton)
                {
                    Destroy(child.gameObject);
                }
            }
            //newButton.Destroy (newButton.GetComponent<Image>);
            //newButton.GetComponent<Image> ().overrideSprite = blankButton;
        }
    }
    //게임을 시작하고 저장되어 있고 처음 퀘스트를 켰을때
    public void QuestSaveInitStart()
    {
        GameObject quest;

        nQuestCount = 0;
        AllDestroyQuest();
        questObjects.Clear();

        int nCurSaveQuestCount = 0;

        if (GameManager.Instance.cQuestSaveListInfo [0].nQuestIndex01 >= 0)
        {
            nCurSaveQuestCount++;
        }
        if (GameManager.Instance.cQuestSaveListInfo [0].nQuestIndex02 >= 0)
        {
            nCurSaveQuestCount++;
        }
        if (GameManager.Instance.cQuestSaveListInfo [0].nQuestIndex03 >= 0)
        {
            nCurSaveQuestCount++;
        }


        //Add
        for (int i = 0; i < nCurSaveQuestCount; i++)
        {
            nQuestCount++;
            quest = questObjectPool.GetObject();
            quest.transform.SetParent(questDay.transform, false);
            quest.transform.localScale = Vector3.one;

            QuestPanel questPanel = quest.gameObject.GetComponent <QuestPanel> ();
            questPanel.nQuestPanelIndex = i;
            questObjects.Add(questPanel);
        }

        QuestSaveDataDispatch();                //Data Dispatch

        questTimer.LoadTimeAndCheckTimeEnd();
        isInitConfirm = false;
    }
Exemple #3
0
    public void CreateText(string strName, float fValue)
    {
        GameObject textObject = simpleTextPool.GetObject();

        textObject.transform.SetParent(parentObject, false);
        textObject.transform.localScale = Vector3.one;

        Text newText = textObject.GetComponent <Text>();

        newText.text = string.Format("{0} {1}", strName, fValue);
    }
Exemple #4
0
    private void ShowQuestion()
    {
        RemoveAnswerButton();
        questionData             = questionPool[questionIndex];
        questionDisplayText.text = questionData.questionText;
        audioDisplay.GetComponent <AudioPanel>().audioClipCommand.GetComponent <AudioController>().UnloadAudio();

        // Manage Audio question.
        if (questionData.questionAudio != null && questionData.questionAudio != "")
        {
            audioDisplay.GetComponent <AudioPanel>().audioClipCommand.GetComponent <AudioController>().LoadAudio(questionData.questionAudio);
            audioDisplay.SetActive(true);
        }

        if (questionData.questionImage != null && questionData.questionImage != "")
        {
            imageDisplay.SetActive(true);
            imageDisplay.GetComponent <Image>().sprite = dataController.getImageSprite(questionData.questionImage);
        }
        else
        {
            imageDisplay.SetActive(false);
        }

        // There 2 types of answer: Button or InputField.
        if (questionData.questionType == "Input")
        {
            for (int i = 0; i < questionData.answers.Length; i++)
            {
                GameObject answerInputGameObject = answerInputObjectPool.GetObject();
                answerInputGameObjects.Add(answerInputGameObject);
                answerInputGameObject.transform.SetParent(answerInputParent);


                AnswerInput answerInput = answerInputGameObject.GetComponent <AnswerInput>();
                answerInput.SetUp(questionData.answers[i]);
            }
        }
        else
        {
            for (int i = 0; i < questionData.answers.Length; i++)
            {
                GameObject answerButtonGameObject = answerButtonObjectPool.GetObject();
                answerButtonGameObjects.Add(answerButtonGameObject);
                answerButtonGameObject.transform.SetParent(answerButtonParent);


                AnswerButton answerButton = answerButtonGameObject.GetComponent <AnswerButton>();
                answerButton.SetUp(questionData.answers[i]);
            }
        }

        dataController.debudText.text += "question display image : " + questionDisplay.GetComponent <Image>().sprite.name;
    }
        private void AddButton()
        {
            foreach (Item item in itemList)
            {
                GameObject newButton = buttonObjectPool.GetObject();
                newButton.transform.SetParent(contentPanel);

//                SkillButton skillButton = newButton.GetComponent<SkillButton>();
//                skillButton.Setup(item, this);
            }
        }
    private void SpawnStoredItem()
    {
        GameObject newItem = itemEquipPool.GetObject();

        newItem.GetComponent <ItemScript>().SetItemObject(item);

        ItemScript.SetSelectedItem(newItem);
        invenManager.selectedButton = this.gameObject;

        GetComponent <CanvasGroup>().alpha = 0.5f;
    }
Exemple #7
0
    private void AddButtons()
    {
        foreach (var item in items)
        {
            GameObject newButton = buttonObjectPool.GetObject();
            newButton.transform.SetParent(contentPanel);

            ListButton button = newButton.GetComponent <ListButton>();
            button.Setup(item, this);
        }
    }
 private void AddButtons()
 {
     for (int i = 0; i < shopItemList.Count; i++)
     {
         ShopItem   shopItem  = shopItemList[i];
         GameObject newButton = buttonObjectPool.GetObject();
         newButton.transform.SetParent(contentPanel, false);
         StoreButton storeButton = newButton.GetComponent <StoreButton>();
         storeButton.Setup(shopItem, this);
     }
 }
Exemple #9
0
 private void AddButtons()
 {
     for (int i = 0; i < filteredDestinationList.Count; i++)
     {
         Destination destination = filteredDestinationList[i];
         GameObject  newButton   = buttonObjectPool.GetObject();
         newButton.transform.SetParent(contentPanel);
         SampleDestinationButton sampleButton = newButton.GetComponent <SampleDestinationButton>();
         sampleButton.Setup(destination, this);
     }
 }
Exemple #10
0
    public void addLog(string text)
    {
        GameObject log;
        Text       msg;

        log = objpool.GetObject();
        log.transform.SetParent(Parent, false);
        msg      = log.GetComponent <Text>();
        msg.text = "   " + text;
        this.log.Add(log);
    }
Exemple #11
0
    private void AddButtons()
    {
        for (int i = 0; i < serviceList.Count; i++)
        {
            Service    service   = serviceList[i];
            GameObject newButton = buttonObjectPool.GetObject();
            newButton.transform.SetParent(contentPanel);

            SampleButton sampleButton = newButton.GetComponent <SampleButton>();
            sampleButton.Setup(service, this);
        }
    }
Exemple #12
0
    private void AddButtons()
    {
        for (int i = 0; i < foodList.Count; ++i)
        {
            FoodObject food      = foodList[i];
            GameObject newButton = buttonObjectPool.GetObject();
            newButton.transform.SetParent(contentPanel, false);             // add false

            ShopButton shopButton = newButton.GetComponent <ShopButton>();
            shopButton.Setup(food, this);
        }
    }
Exemple #13
0
    private void AddButtons()
    {
        for (int i = 0; i < profiles.Count; i++)
        {
            Profile    p          = profiles[i];
            GameObject newProfile = profilePool.GetObject();
            newProfile.transform.SetParent(contentPanel);

            ProfileTile profileTile = newProfile.GetComponent <ProfileTile>();
            profileTile.SetUp(p, this);
        }
    }
Exemple #14
0
    private void AddButtons()
    {
        for (int i = 0; i < markerLists.Count; i++)
        {
            Destination newDest   = markerLists[i];
            GameObject  newButton = buttonObjectPool.GetObject();
            newButton.transform.SetParent(contentPanel);

            SampleMarkerButton sampleButton = newButton.GetComponent <SampleMarkerButton>();
            sampleButton.Setup(newDest, this, UIManager, markersManager);
        }
    }
Exemple #15
0
    private void AddButtons(List <Seed> seeds)
    {
        for (int i = 0; i < seeds.Count; i++)
        {
            Seed       seed      = seeds[i];
            GameObject newButton = buttonObjectPool.GetObject();
            newButton.transform.SetParent(contentPanel);

            SeedButton seedButton = newButton.GetComponent <SeedButton>();
            seedButton.Setup(seed);
        }
    }
Exemple #16
0
    private void AddControllers()
    {
        for (int i = 0; i < controllerList.Count; i++)
        {
            Controller controller    = controllerList[i];
            GameObject newController = controllerObjectPool.GetObject();
            newController.transform.SetParent(contentPanel);

            SampleController sampleController = newController.GetComponent <SampleController>();
            sampleController.Setup(controller);
        }
    }
    private void AddShoppingListItems()
    {
        for (int i = 0; i < listToDisplay.Count; i++)
        {
            ShoppingListItem item           = listToDisplay[i];
            GameObject       newProductCard = shoppinglistObjectPool.GetObject();
            newProductCard.transform.SetParent(shoppingListPanel);

            ShopphingListDisplay listItem = newProductCard.GetComponent <ShopphingListDisplay>();
            listItem.Setup(item);
        }
    }
Exemple #18
0
    //--------------------------------------------------------------------
    //-Add to Inventory Code----------------------------------------------
    //--------------------------------------------------------------------
    private void AddToButtonsShopInventory()
    {
        for (int i = 0; i < shopItemList.Count; i++)
        {
            Item       item      = shopItemList[i].itemShop;
            GameObject newButton = buttonObjectPool.GetObject();
            newButton.transform.SetParent(contentPanel.transform);

            SampleButton sampleButton = newButton.GetComponent <SampleButton>();
            sampleButton.Setup(item, this, contentPanel, i, shopItemList[i]);
        }
    }
Exemple #19
0
    private void AddButtons()
    {
        for (int i = 0; i < itemList.Count; i++)
        {
            Item       item      = itemList [i];
            GameObject newButton = buttonObjectPool.GetObject();
            newButton.transform.SetParent(contentPanel);

            LevelSelectButton levelButton = newButton.GetComponent <LevelSelectButton> ();
            levelButton.SetUp(item, this);
        }
    }
    public void AddButtons()
    {
        for (int i = 0; i < ItemList.Count; i++)
        {
            Item       item      = ItemList[i];
            GameObject newButton = buttonObjectPool.GetObject();
            newButton.transform.SetParent(contentPanel);

            MovementButton button = newButton.GetComponent <MovementButton>();
            button.Setup(item, this);
        }
    }
    private void AddButton()
    {
        for (int i = 0; i < itemList.Count; i++)
        {
            Item       item      = itemList[i];
            GameObject newButton = buttonObjectPool.GetObject();
            newButton.transform.SetParent(contentPanel, false);

            SampleButton sampleButton = newButton.GetComponent <SampleButton>();
            sampleButton.Setup(item, this);
        }
    }
Exemple #22
0
 public void AddButtons()
 {
     for (int i = 0; i < Player.propertyList.Count; i++)
     {
         string nieruchomosci = Player.propertyList[i];
         newButton = buttonObjectPool.GetObject();
         newButton.GetComponentInChildren <Text>().text = Player.propertyList[i];
         newButton.transform.SetParent(contentPanel, false);
         SampleButton sampleButton = newButton.GetComponent <SampleButton>();
         sampleButton.Setup(nieruchomosci, scrollList);
     }
 }
    private void AddButtons()
    {
        for (int i = 0; i < itemList.Count; i++)
        {
            Item       item      = itemList[i];
            GameObject newButton = objectPool.GetObject();
            newButton.transform.SetParent(this.contentPanel);

            ButtonScript button = newButton.GetComponent <ButtonScript>();
            button.Setup(item, this, this.popupSpawn);
        }
    }
Exemple #24
0
    private void AddButtons()
    {
        for (int i = 0; i < characterList.Count; i++)
        {
            CharacterData chara     = characterList[i];
            GameObject    newButton = buttonObjectPool.GetObject();
            newButton.transform.SetParent(contentPanel, false);

            SampleCharacterButton sampleButton = newButton.GetComponent <SampleCharacterButton>();
            sampleButton.Setup(chara);
        }
    }
    private void AddButtons()
    {
        for (int i = 0; i < taskList.Count; i++)
        {
            Task       item      = taskList[i];
            GameObject newButton = buttonObjectPool.GetObject();
            newButton.transform.SetParent(contentPanel);

            TaskButton sampleButton = newButton.GetComponent <TaskButton>();
            sampleButton.Setup(item, this);
        }
    }
Exemple #26
0
    private void CreateLeaderboardEntry(Score s)
    {
        GameObject       newEntry = entriesPool.GetObject();
        LeaderBoardEntry entry    = newEntry.GetComponent <LeaderBoardEntry>();

        entry.enabled = true;

        entry.score.name  = s.name;
        entry.score.score = s.score;

        newEntry.transform.SetParent(contentPanel);
        newEntry.transform.position = new Vector3(newEntry.transform.position.x, newEntry.transform.position.y, -1.0f);
    }
    void ShowQuestion()
    {
        for (int i = 0; i < roundList.Length; i++)                               // For every AnswerData in the current QuestionData...
        {
            GameObject quizButtonGameObject = quizbutonObjectPool.GetObject();   // Spawn an AnswerButton from the object pool
            answerButtonGameObjects.Add(quizButtonGameObject);
            quizButtonGameObject.transform.SetParent(quizButtonParent);
            quizButtonGameObject.transform.localScale = Vector3.one;

            QuizButton answerButton = quizButtonGameObject.GetComponent <QuizButton>();
            answerButton.SetUp(roundList[i]);                                    // Pass the AnswerData to the AnswerButton so the AnswerButton knows what text to display and whether it is the correct answer
        }
    }
    public void AddButtons()
    {
        for (int i = 0; i < DataManager.Instance.messageList.Count; i++)
        {
            Message    message   = DataManager.Instance.messageList[i];
            GameObject newButton = buttonObjectPool.GetObject();

            newButton.transform.SetParent(contentPanel);
            newButton.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
            MessageButton messageButton = newButton.GetComponent <MessageButton>();
            messageButton.Setup(message);
        }
    }
Exemple #29
0
 private void AddButtons()
 {
     for (int i = 0; i < itemsToSell.Count; i++)
     {
         InventoryItem item      = itemsToSell[i];
         GameObject    newButton = itemPool.GetObject();
         newButton.transform.SetParent(panel);
         RectTransform rt = newButton.GetComponent <RectTransform>();
         rt.localScale = new Vector3(1, 1, 1);
         ShopItem tempShopItem = newButton.GetComponent <ShopItem>();
         tempShopItem.Setup(item, this);
     }
 }
Exemple #30
0
    private void AddButtons()
    {
        for (int i = 0; i < itemList.Count; i++)
        {
            Debug.Log(itemList.Count);
            Item       item      = itemList[i];
            GameObject newButton = buttonObjectPool.GetObject();
            newButton.transform.SetParent(contentPanel, false);

            ButtonController sampleButton = newButton.GetComponent <ButtonController>();
            sampleButton.Setup(item, this);
        }
    }