private void ItlDisplayGoToNextLevelMessage()
    {
        GameObject guiGO      = GameObject.FindWithTag("GUIMaster");
        GUIMaster  pGUIMaster = guiGO.GetComponent <GUIMaster>();

        pGUIMaster.ShowText("GROOVY", "Press RETURN");
    }
 private void OnGUI()
 {
     for (int i = 0; i < playerManager.GetPlayers().Count; i++)
     {
         GUI.Label(GUIMaster.GetElementRect(playerRects[i]), "Player " + playerManager.GetPlayers()[i].playerId + ": " + playerManager.GetPlayers()[i].score, scaledTextStyle);
     }
 }
        public override void Enable(City city, GUIMaster gui)
        {
            this.selectedCity   = city;
            this.selectedButton = null;
            base.Enable(city, gui);

            //Clear List Entries and Texts
            selectionTitle.text = "";
            selectionDesc.text  = "";
            foreach (ProjectButton b in availableProjectList.GetComponentsInChildren <ProjectButton>())
            {
                Destroy(b.transform.gameObject);
            }
            foreach (ProjectButton b in unavailableProjectsList.GetComponentsInChildren <ProjectButton>())
            {
                Destroy(b.transform.gameObject);
            }

            //TODO: Implement automatic buttons
            //Populate project lists
            foreach (string projectID in selectedCity.construction.GetAvailableProjects())
            {
                ProjectButton pb = Instantiate(projectButtonPrefab);
                pb.transform.SetParent(availableProjectList.transform);
                pb.ProjectSelector = this;
                pb.text.text       = GlobalProjectDictionary.GetProjectData(projectID).Name;
                pb.ProjectID       = projectID;
            }

            UpdateGUI();
        }
    private void ItlDisplayOverallWinningMessage()
    {
        GameObject guiGO      = GameObject.FindWithTag("GUIMaster");
        GUIMaster  pGUIMaster = guiGO.GetComponent <GUIMaster>();

        pGUIMaster.ShowText("YOU WON!", "ESC to Menu", string.Format("{0} Points!", m_iOverallPoints));
    }
    public void DisplaySongOverMessage()
    {
        GameObject guiGO      = GameObject.FindWithTag("GUIMaster");
        GUIMaster  pGUIMaster = guiGO.GetComponent <GUIMaster>();

        pGUIMaster.ShowText("Song Over", "ESC to Menu", string.Format("{0} Points!", m_iOverallPoints));
    }
 private void Update()
 {
     if (!Application.isPlaying)
     {
         GUIMaster.UpdateMember(identifier, this);
     }
 }
 void Update()
 {
     if (lastScreenWidth != Screen.width)
     {
         lastScreenWidth = Screen.width;
         GUIMaster.OnResolutionChanged();
     }
 }
Beispiel #8
0
 public void OnGUI()
 {
     GUI.depth    = 99;
     screenOffset = new Vector2(GUIMaster.GetElementRect(element).width / 3f, GUIMaster.GetElementRect(element).height * 2f);
     GUI.color    = new Color(Color.white.r, Color.white.b, Color.white.b, .5f);
     GUI.DrawTexture(new Rect(Camera.main.WorldToScreenPoint(transform.position).x - screenOffset.x, Screen.height - Camera.main.WorldToScreenPoint(transform.position).y - screenOffset.y, GUIMaster.GetElementRect(element).width, GUIMaster.GetElementRect(element).height), questionManager.GetTexture(activeQuestion.difficulty));
     GUI.color = Color.white;
 }
Beispiel #9
0
 public IEnumerator OnSelect(City city, GUIMaster gui)
 {
     gui.districtSelectorScript.Enable(city, this, gui);
     while (!finishedSelection)
     {
         yield return(null);
     }
 }
Beispiel #10
0
 public void CleanUp()
 {
     InputMan = null;
     ActiveCharacters.Clear();
     LevelMap = new Level();
     GUI = null;
     PlayerObject = null;
     BattleMan = new BattleManager();
 }
Beispiel #11
0
 public void CleanUp()
 {
     InputMan = null;
     ActiveCharacters.Clear();
     LevelMap     = new Level();
     GUI          = null;
     PlayerObject = null;
     BattleMan    = new BattleManager();
 }
    public void OnGUI()
    {
        GUI.depth = depth;

        if (interactable)
        {
            GUI.DrawTexture(GUIMaster.GetElementRect(guiElement), texture);
        }
    }
        public virtual IEnumerator OnSelect(City city, GUIMaster gui)
        {
            ConstructedTileGhost ghost = Object.Instantiate(gui.ghostPrefab);

            yield return(ghost.Place(city, gui.Game.World, this, gui.GUIState));

            Object.Destroy(ghost.gameObject);

            yield break;
        }
    private void Update()
    {
        scaledTextStyle = GUIMaster.ResolutionGUIStyle(textStyle);
        scaledBoxStyle  = GUIMaster.ResolutionGUIStyle(boxStyle);

        if (playerManager.JumpsLeft() > 0 && finished)
        {
            jumpsLeftDiceTexture = diceTextures [playerManager.JumpsLeft() - 1].texture;
        }
    }
Beispiel #15
0
        public string GetDescription(GUIMaster gui)
        {
            string output = (selectedProjectID == null ? "No Selected Construction Project" : GlobalProjectDictionary.GetProjectData(selectedProjectID).GetDescription(city, gui.Game)) + "\n";

            if (project != null)
            {
                output += "\n" + project.GetSelectionInfo(gui);
            }
            output += "\n<b>Progress:</b> " + constructionProgress + "/" + requiredConstructionProgress;
            return(output);
        }
Beispiel #16
0
 public void CancelProject(GUIMaster gui)
 {
     if (project != null)
     {
         project.OnCancel(city, gui);
         foreach (KeyValuePair <string, int> resource in allocatedResources)
         {
             gui.Game.GlobalInventory.AddItem(new ResourceItem(resource.Key, resource.Value));
         }
     }
     CloseProject();
 }
Beispiel #17
0
        public static CityScript Create(string name, Vector3 position, GUIMaster gui)
        {
            CityScript script = Instantiate(gui.cityPrefab, position, new Quaternion());

            script.state = gui.GUIState;
            script.city  = new City(name, gui.Game.World.WorldToCell(position));
            script.panel = gui.cityGUI;

            gui.Game.AddNewCity(script.city);
            script.title.text = name + "(" + script.city.population + ")";
            return(script);
        }
        public void Enable(City city, Building building, GUIMaster gui)
        {
            //this.city = city;
            this.building = building;
            this.gui      = gui;

            // Clear lists
            foreach (VerticalLayoutGroup districtPanel in districtList.GetComponentsInChildren <VerticalLayoutGroup>())
            {
                if (districtPanel.gameObject.name != "District List")
                {
                    Destroy(districtPanel.gameObject);
                }
            }

            // Load all districts
            // Foreach instantiate district panel prefab
            for (int i = 0; i < city.Districts.Count; i++)
            {
                District            district      = city.Districts[i];
                VerticalLayoutGroup districtPanel = Instantiate(districtPanelPrefab);
                districtPanel.transform.SetParent(districtList.transform);
                districtPanel.GetComponentInChildren <Text>().text = district.Name;
                Button districtButton = districtPanel.GetComponentInChildren <Button>();
                districtButton.onClick.AddListener(() => SelectDistrict(district, districtButton));

                // Load building slots
                // Foreach instantiate building slot prefab
                VerticalLayoutGroup slotList = districtPanel.GetComponentsInChildren <VerticalLayoutGroup>()[1];
                slotList.gameObject.SetActive(true);
                foreach (Building b in district.Buildings)
                {
                    RectTransform slot = Instantiate(buildingSlotPrefab);
                    string        name = "Empty";
                    if (b != null)
                    {
                        name = b.ID; // TODO: Change to building.Name
                    }
                    slot.GetComponentInChildren <Text>().text = name;
                    slot.SetParent(slotList.transform);
                }

                if (district.Buildings.Count == 0)
                {
                    slotList.gameObject.SetActive(false);
                }
            }

            confirmButton.interactable = false;
            gameObject.SetActive(true);
        }
Beispiel #19
0
        public void Initialize(string id, Vector3Int position, GUIMaster gui, World world, UnitEntity unitEntity)
        {
            unitID = id;
            Sprite sprite = Resources.Load <Sprite>("Unit Entity Sprites/" + id);

            GetComponent <SpriteRenderer>().sprite = sprite;

            transform.position = world.CellToWorld(position);
            this.gui           = gui;
            this.world         = world;
            this.unitEntity    = unitEntity;

            unitEntity.OnDeath += OnDeath;
        }
Beispiel #20
0
    private void OnGUI()
    {
        scaledButtonStyle = GUIMaster.ResolutionGUIStyle(buttonStyle);

        GUI.DrawTexture(GUIMaster.GetElementRect(logoElement), logo);

        if (GUI.Button(GUIMaster.GetElementRect(level1Button), "Robot Level", scaledButtonStyle))
        {
            Application.LoadLevel("DemoLevel");
        }
        if (GUI.Button(GUIMaster.GetElementRect(level2Button), "Nature Level", scaledButtonStyle))
        {
            Application.LoadLevel("DemoLevel_Nature");
        }
    }
Beispiel #21
0
        public void SetProject(IProject selectedProject, GUIMaster gui)
        {
            CancelProject(gui);

            // Update values
            selectedProjectID = selectedProject.ID;
            project           = selectedProject;
            UpdateConstructionProgressCost(gui.Game);

            // Take needed resources
            //TODO: Incorporate modifiers
            //Assumes enough resources in inventory
            foreach (KeyValuePair <string, int> resource in selectedProject.GetResourceCost(city, gui.Game))
            {
                gui.Game.GlobalInventory.AddItem(new ResourceItem(resource.Key, -resource.Value));
                allocatedResources.Add(resource.Key, resource.Value);
            }
        }
    private void ItlFindObjects()
    {
        Debug.Log("LevelAndPointBehaviour::ItlFindObjects");

        GameObject guiGO = GameObject.FindWithTag("GUIMaster");

        m_pGUIMaster = guiGO.GetComponent <GUIMaster>();
        m_pGUIMaster.HideText();

        GameObject dpGO = GameObject.FindWithTag("DiscoPete");

        m_pDiscoPete = dpGO.GetComponent <DiscoPeteBehaviour>();

        GameObject gmGO = GameObject.FindWithTag("GridMaster");

        m_pGridMaster = gmGO.GetComponent <GridMaster>();

        GameObject bmGO = GameObject.FindWithTag("Music");

        m_pBeatMaster            = bmGO.GetComponent <BeatMaster>();
        m_pBeatMaster.beatEvent += OnBeat;

        if (m_pGUIMaster == null)
        {
            Debug.Log("LevelAndPointBehaviour: GUIMaster not found");
        }

        if (m_pDiscoPete == null)
        {
            Debug.Log("LevelAndPointBehaviour: DiscoPeteBehaviour not found");
        }

        if (m_pGridMaster == null)
        {
            Debug.Log("LevelAndPointBehaviour: GridMaster not found");
        }

        if (m_pBeatMaster == null)
        {
            Debug.Log("LevelAndPointBehaviour: BeatMaster not found");
        }
    }
    private void OnGUI()
    {
        //This defines on which layer the GUI will be drawn.
        GUI.depth = depth;

        Rect rect = GUIMaster.GetElementRect(element);

        GUI.DrawTexture(rect, normalButton);

        if (rect.Contains(Event.current.mousePosition) && interactable)
        {
            GUI.DrawTexture(rect, highlightButton);
            if (Event.current.type == EventType.mouseUp)
            {
                Hierarchy.GetComponentWithTag <SoundSettings>("SoundManager").Play(sound);
                GUI.DrawTexture(rect, normalButton);
                Application.LoadLevel(sceneToLoad);
            }
        }
    }
Beispiel #24
0
    private void OnGUI()
    {
        //This defines on which layer the GUI will be drawn.
        GUI.depth = depth;

        Rect rect = GUIMaster.GetElementRect(element);

        GUI.DrawTexture(rect, normalButton);

        if (rect.Contains(Event.current.mousePosition) && interactable)
        {
            GUI.DrawTexture(rect, highlightButton);
            if (Event.current.type == EventType.mouseUp)
            {
                Hierarchy.GetComponentWithTag <SoundSettings>("SoundManager").Play(sound);
//				Debug.Log("Moo");
                GUI.DrawTexture(rect, normalButton);
                toggleComponent.ToggleInteractable();

                toggleComponent.enabled = (!toggleComponent.enabled) ? true : false;
            }
        }
    }
Beispiel #25
0
    private void OnGUI()
    {
        List <Transform> transforms = new List <Transform>(Selection.GetTransforms(SelectionMode.TopLevel | SelectionMode.OnlyUserModifiable));

        if (!Application.isPlaying)
        {
            foreach (KeyValuePair <string, GUIMember> r in GUIMaster.GUIMembers)
            {
                if (r.Value != null)
                {
                    if (!r.Value.show)
                    {
                        continue;
                    }

                    if (r.Value.previewTexture != null)
                    {
                        GUIStyle style = new GUIStyle();
                        style.normal.background = r.Value.previewTexture;
                        GUI.Box(r.Value.GetScaledRect(), "", style);
                    }

                    if (transforms.Contains(r.Value.transform))
                    {
                        GUI.color = Color.red;
                        GUIMaster.OnResolutionChanged();
                    }

                    GUI.Box(r.Value.GetScaledRect(), "", box);

                    GUI.color = Color.white;
                }
            }
        }

        GetMainGameView().Repaint();
    }
    private void OnGUI()
    {
        GUI.Label(GUIMaster.GetElementRect(diceTextRect), "You rolled:", scaledTextStyle);
        GUI.DrawTexture(GUIMaster.GetElementRect(firstDiceRect), currentDiceTexture);

        GUI.Label(GUIMaster.GetElementRect(jumpsLeftRect), "Jumps left:", scaledTextStyle);
        if (playerManager.JumpsLeft() > 0 && jumpsLeftDiceTexture != null)
        {
            GUI.DrawTexture(GUIMaster.GetElementRect(secondDiceRect), jumpsLeftDiceTexture);
        }
        else
        {
            GUI.Label(GUIMaster.GetElementRect(secondDiceRect), "None", scaledTextStyle);
        }

        if (diceManager.CanRoll())
        {
            GUI.Label(GUIMaster.GetElementRect(messageRect), "Klik hieronder om de dobbelsteen te rollen!", scaledBoxStyle);
            if (GUI.Button(GUIMaster.GetElementRect(messageButtonRect), "Rol!", scaledBoxStyle))
            {
                playerManager.SetJumps();
            }
        }
    }
Beispiel #27
0
 public void Init( GUIMaster gui )
 {
     GUI = gui;
     CheckInits();
 }
Beispiel #28
0
 public override string GetSelectionInfo(GUIMaster gui)
 {
     return("Name: " + Name);
 }
 public virtual void OnCancel(City city, GUIMaster gui)
 {
     gui.Game.World.PlaceConstructedTile(position, null);
     //TODO: Manage deselect constructed tile upgrade case
 }
 public abstract string GetSelectionInfo(GUIMaster gui);
Beispiel #31
0
 private void Start()
 {
     //Simulating the first resolution change to get everything up and running.
     GUIMaster.OnResolutionChanged();
 }
Beispiel #32
0
        public override string GetSelectionInfo(GUIMaster gui)
        {
            float aspect = UseFertility ? gui.Game.World.GetFertilityAtTile(position) : gui.Game.World.GetRichnessAtTile(position);

            return((UseFertility ? "Fertility: " : "Richness: ") + System.Math.Round(aspect, 2));
        }