コード例 #1
0
    public void LevelItemClicked(LevelItem item)
    {
        if (item == this.selectedLevel)
        {
            return;
        }

        DeselectLevelItems();

        selectedLevel = item;
        selectedLevel.GetComponent <Image> ().color = selectedColor;

        this.selectedQuestName.text = selectedLevel.levelName;
        this.selectedQuestDesc.text = selectedLevel.levelData.Description;

        Dictionary <string, int> charStats = PF_PlayerData.characterStatistics [PF_PlayerData.activeCharacter.characterDetails.CharacterId];


        if (PF_PlayerData.characterStatistics.Count > 0)
        {
            if (charStats.ContainsKey(selectedLevel.levelData.StatsPrefix + "Complete"))
            {
                if (PF_GamePlay.isHardMode == true)
                {
                    this.HardMode.GetComponent <Image> ().overrideSprite = this.checkBoxChecked;
                }
                else
                {
                    this.HardMode.GetComponent <Image> ().overrideSprite = this.checkBox;
                }
                this.HardMode.gameObject.SetActive(true);
            }
            else
            {
                this.HardMode.gameObject.SetActive(false);
            }
        }
        else
        {
            this.HardMode.gameObject.SetActive(false);
        }

        //ShowSelectedLevel();
    }
コード例 #2
0
ファイル: LevelPicker.cs プロジェクト: youdk/UnicornBattle
    public void LevelItemClicked(string levelname)
    {
        DeselectLevelItems();

        LevelItem item = null;

        foreach (var eachLevel in levelItems)
        {
            if (eachLevel.levelName == levelname)
            {
                item = eachLevel;
            }
        }
        if (item == null || item == selectedLevel)
        {
            return;
        }

        selectedLevel = item;
        selectedLevel.GetComponent <Image>().color = selectedColor;

        selectedQuestName.text = selectedLevel.levelName;
        selectedQuestDesc.text = selectedLevel.levelData.Description;

        Dictionary <string, int> charStats = PF_PlayerData.characterStatistics[PF_PlayerData.activeCharacter.characterDetails.CharacterId];

        if (PF_PlayerData.characterStatistics.Count > 0)
        {
            var hardModeAvailable = charStats.ContainsKey(selectedLevel.levelData.StatsPrefix + "Complete");
            HardMode.gameObject.SetActive(hardModeAvailable);
            if (hardModeAvailable)
            {
                SetCheckBoxSprite(HardMode.GetComponent <Image>(), PF_GamePlay.isHardMode);
            }
        }
        else
        {
            HardMode.gameObject.SetActive(false);
        }

        //ShowSelectedLevel();
    }
コード例 #3
0
ファイル: GameScrollUI.cs プロジェクト: Zeppar/Voice
    private IEnumerator StartScroll()
    {
        while (true)
        {
            yield return(new WaitForEndOfFrame());

            if (itemParent.childCount != 0)
            {
                yield return(new WaitForEndOfFrame());

                items = itemParent.GetComponentsInChildren <LevelItem>();
                Debug.Log(itemParent.GetComponent <RectTransform>().sizeDelta.x);
                Debug.Log(itemParent.GetComponent <RectTransform>().sizeDelta.y);
                Debug.Log(GetComponent <RectTransform>().rect.width);
                Debug.Log(GetComponent <RectTransform>().rect.height);
                totalScrollLength = itemParent.GetComponent <RectTransform>().sizeDelta.x - GetComponent <RectTransform>().rect.width;
                oneItemWidth      = item.GetComponent <LayoutElement>().preferredWidth;
                isInit            = true;
                break;
            }
        }
    }