コード例 #1
0
    void Start()
    {
        switch (GType)
        {
        case GameType.QuickFire:
            BaseUIController.topMenu = SupportTools.AddChild <TopMenuQuickFire>(BaseUIController.TopMenuRoot.gameObject, "UI/BattleScene/TopMenuQuickFire");
            Rules = gameObject.AddComponent <PoolRulesQuickFire>();
            break;

        case GameType.Standard:
            BaseUIController.topMenu = SupportTools.AddChild <TopMenuStandard>(BaseUIController.TopMenuRoot.gameObject, "UI/BattleScene/TopMenuStandard");
            Rules = gameObject.AddComponent <PoolRulesStandard>();
            break;

        case GameType.Mission:
            BaseUIController.topMenu = SupportTools.AddChild <TopMenuMission>(BaseUIController.TopMenuRoot.gameObject, "UI/BattleScene/TopMenuMission");
            Rules = gameObject.AddComponent <PoolRulesMission>();
            break;

        case GameType.AI:
            BaseUIController.topMenu = SupportTools.AddChild <TopMenuStandard>(BaseUIController.TopMenuRoot.gameObject, "UI/BattleScene/TopMenuMultipleAI");
            Rules = gameObject.AddComponent <PoolRulesMultiple>();
            break;
        }
        Rules.SetPlayers(BaseUIController.topMenu.GetPlayers());
    }
コード例 #2
0
    void Start()
    {
        int progress = 0, i = 0;

        foreach (var v in AchieveConfiguration.achieveDictionary)
        {
            i++;
            AchieveItem item = SupportTools.AddChild <AchieveItem>(m_Root.gameObject, m_AchieveItemPrefab.gameObject);
            int         id   = v.Key;
            item.achieveName.text   = v.Value.name;
            item.description.text   = v.Value.DescriptionID.ToString();
            item.achieveIcon.sprite = Resources.Load <Sprite>("UI/LaunchScene/AchieveIcon/" + v.Value.IconName);
            if (ConstantData.achieveRecords[id] < v.Value.goal)
            {
                item.progress.gameObject.SetActive(true);
                item.finishFlag.gameObject.SetActive(false);
                item.progress.text = ConstantData.achieveRecords[id] + "/" + v.Value.goal;
                item.backGround    = Color.gray;
            }
            else
            {
                item.progress.gameObject.SetActive(false);
                item.finishFlag.gameObject.SetActive(true);
                item.backGround = Color.white;
                progress++;
            }
        }
        m_Progress.text = progress + "/" + AchieveConfiguration.achieveDictionary.Count;
        m_Root.GetComponent <RectTransform>().sizeDelta = new Vector2(m_Root.cellSize.x, i * m_Root.cellSize.y + (i - 1) * m_Root.spacing.y);
    }
コード例 #3
0
    void Start()
    {
        ChapterCities chapterCityPrefab = m_ChapterRoot.transform.GetChild(0).GetComponent <ChapterCities>();

        chapterCityPrefab.transform.SetParent(null);

        int i = 0;

        foreach (var v in ChapterConfiguration.chapterDictionary)
        {
            i++;
            ChapterInfo   c           = v.Value;
            ChapterCities chapterCity = SupportTools.AddChild <ChapterCities>(m_ChapterRoot.gameObject, chapterCityPrefab.gameObject);
            chapterCity.text.text = c.name;
            chapterCity.name      = c.imageName.Substring(6); //imageName = Image_xxxxx  we just wanna get the real name
            chapterCity.chapter   = c.chapter;
            Sprite sprite = Resources.Load <Sprite>("UI/LaunchScene/MissionCards/" + c.imageName);
            if (sprite)
            {
                chapterCity.image.sprite = sprite;
            }
            bool b = c.chapter > ConstantData.LevelDatas.GetChapter(m_MissionProgress);
            chapterCity.lockMask.SetActive(b);
            int star = 0;
            if (!b)
            {
                star = ConstantData.missionRecords.GetChapterStars(v.Key);
            }
            chapterCity.process.text = string.Format(HOLocalizationConfiguration.GetValue(104), star, 60);
        }
        Destroy(chapterCityPrefab.gameObject);
        m_ChapterRoot.GetComponent <RectTransform>().sizeDelta = new Vector2(i * m_ChapterRoot.cellSize.x + i * m_ChapterRoot.spacing.x, m_ChapterRoot.cellSize.y);
        m_ChapterSnapElement.Initialize();
    }
コード例 #4
0
 protected void AddBalls(int min, int max)
 {
     for (int i = min; i <= max; i++)
     {
         if (!Pools.Balls[i].IsBallDisable())
         {
             m_TargetBalls.Add(Pools.Balls[i]);
             Image o = SupportTools.AddChild <Image>(m_SlotsRoot.gameObject, "UI/BattleScene/Slot");
             o.sprite         = Resources.Load <Sprite>("BallsIcon/" + i.ToString());
             o.transform.name = i.ToString();
         }
     }
 }
コード例 #5
0
 public BGMPlayer(GameObject o)
 {
     m_BGMs = new AudioSource[2];
     for (int i = 0; i < 2; i++)
     {
         m_BGMs[i]             = SupportTools.AddChild <AudioSource>(o);
         m_BGMs[i].name        = "BGM_" + (i + 1);
         m_BGMs[i].loop        = true;
         m_BGMs[i].playOnAwake = false;
         m_BGMs[i].volume      = !ConstantData.Sound ? 0 : 1;
         m_BGMs[i].pitch       = 1;
     }
     m_focus          = BGMFocus.Second;
     m_BGMs[1].volume = 0;
 }
コード例 #6
0
    private TextTips GetTextTip()
    {
        TextTips tip = null;

        for (int i = 0; i < m_TipsCache.Count; i++)
        {
            if (m_TipsCache[i] != null && !m_TipsCache[i].gameObject.activeInHierarchy)
            {
                tip = m_TipsCache[i];
                tip.gameObject.SetActive(true);
                return(tip);
            }
        }
        tip = SupportTools.AddChild <TextTips>(gameObject, m_Tips.gameObject);
        m_TipsCache.Add(tip);
        return(tip);
    }
コード例 #7
0
    void Awake()
    {
        if (m_Instance == null)
        {
            m_Instance = this;
            DontDestroyOnLoad(gameObject);

            //Get music toggle
            if (!PlayerPrefs.HasKey(ConstantData.MusicVolumnKey))
            {
                ConstantData.Music = true;
            }
            else
            {
                ConstantData.Music = PlayerPrefs.GetInt(ConstantData.MusicVolumnKey) == 1;
            }

            //Get sound toggggggggggggggggggggggggle
            if (!PlayerPrefs.HasKey(ConstantData.SoundVolumnKey))
            {
                ConstantData.Sound = false;
            }
            else
            {
                ConstantData.Sound = PlayerPrefs.GetInt(ConstantData.SoundVolumnKey) == 1;
            }

            m_OneShotSource          = GetComponent <AudioSource>();
            m_LoopSource             = SupportTools.AddChild <AudioSource>(gameObject);
            m_LoopSource.loop        = true;
            m_LoopSource.playOnAwake = false;
            m_LoopSource.name        = "Loop source";
            m_ClipsPool = new System.Collections.Generic.Dictionary <string, AudioClip>(m_ClipsPoolCount);
            m_BGMPlayer = new BGMPlayer(gameObject);
        }
        else
        {
            Destroy(gameObject);
        }
    }
コード例 #8
0
    private void LoadLevelWithChapter(int chapter)
    {
        ConstantData.LoadedChapter = chapter;
        int childCount           = m_LevelRoot.transform.childCount;
        IList <LevelData> levels = ConstantData.LevelDatas.DumpLevelDatasWithChapter(chapter);
        int i;

        for (i = 0; i < levels.Count; i++)
        {
            ChapterLevel l;
            if (i < childCount)
            {
                l = m_LevelRoot.transform.GetChild(i).GetComponent <ChapterLevel>();
            }
            else
            {
                l = SupportTools.AddChild <ChapterLevel>(m_LevelRoot.gameObject, m_ChapterLevelPrefab.gameObject);
            }
            l.gameObject.SetActive(true);
            l.levelData = levels[i];
            l.text.text = (i + 1).ToString();
            l.name      = "Level-" + l.text.text;
            l.SetStar(ConstantData.missionRecords.GetStar(levels[i].FileName));
            bool levelLock = ConstantData.LevelDatas.Comp(m_MissionProgress, levels[i].FileName) == -1;
            l.mask.SetActive(levelLock);
            if (levelLock)
            {
                l.text.transform.localScale = Vector3.one * .72f;
            }
            else
            {
                l.text.transform.localScale = Vector3.one;
            }
        }
        m_LevelRoot.GetComponent <RectTransform>().sizeDelta = new Vector2(i * m_LevelRoot.cellSize.x + (i - 1) * m_LevelRoot.spacing.x, m_LevelRoot.cellSize.y);
        while (i < childCount)
        {
            m_LevelRoot.transform.GetChild(i).gameObject.SetActive(false);
        }
    }
コード例 #9
0
    public static void Show(string text)
    {
        TextDialog dialog = SupportTools.AddChild <TextDialog>(GameManager.CurrentUIRoot.gameObject, "UI/TextDialog");

        dialog._Show(text);
    }
コード例 #10
0
    public static void Show(string text)
    {
        AchieveTopBar topBar = SupportTools.AddChild <AchieveTopBar>(GameManager.CurrentUIRoot.gameObject, "UI/AchieveTopBar");

        topBar._Show(text);
    }