Example #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new UISpriteBatch(GraphicsDevice, 3);

            // TODO: use this.Content to load your game content here
            int Channel = Bass.BASS_StreamCreateFile("Sounds\\BUTTON.WAV", 0, 0, BASSFlag.BASS_DEFAULT);

            UISounds.AddSound(new UISound(0x01, Channel));

            GameFacade.MainFont = new TSOClient.Code.UI.Framework.Font();
            GameFacade.MainFont.AddSize(10, Content.Load <SpriteFont>("Fonts/ProjectDollhouse_10px"));
            GameFacade.MainFont.AddSize(12, Content.Load <SpriteFont>("Fonts/ProjectDollhouse_12px"));
            GameFacade.MainFont.AddSize(14, Content.Load <SpriteFont>("Fonts/ProjectDollhouse_14px"));
            GameFacade.MainFont.AddSize(16, Content.Load <SpriteFont>("Fonts/ProjectDollhouse_16px"));

            GameFacade.SoundManager = new TSOClient.Code.Sound.SoundManager();
            GameFacade.GameThread   = Thread.CurrentThread;

            ScreenMgr = new ScreenManager(this, Content.Load <SpriteFont>("ComicSans"),
                                          Content.Load <SpriteFont>("ComicSansSmall"));
            SceneMgr = new SceneManager(this);

            GameFacade.Controller     = new GameController();
            GameFacade.Screens        = ScreenMgr;
            GameFacade.Scenes         = SceneMgr;
            GameFacade.GraphicsDevice = GraphicsDevice;

            /** Init any computed values **/
            GameFacade.Init();

            GameFacade.LastUpdateState = m_UpdateState;
            GameFacade.Strings         = new ContentStrings();
            GameFacade.Controller.StartLoading();
        }
    public void clicked()
    {
        UIBase uiBase = UIBase.instance;

        if (uiBase && uiBase.openSkillTrees.Count > 0)
        {
            SkillTree  openSkillTree = uiBase.openSkillTrees[0];
            GameObject player        = PlayerFinder.getPlayer();
            if (openSkillTree && player && player.GetComponent <SpecialisedAbilityList>())
            {
                // de-allocate all the nodes
                foreach (SkillTreeNode node in SkillTreeNode.all)
                {
                    if (node.tree == openSkillTree)
                    {
                        node.pointsAllocated = 0;
                        node.updateText();
                    }
                }
                // set unspent points to 1
                openSkillTree.unspentPoints = 1;
                // update the mutator now that the points are de-allocated
                openSkillTree.updateMutator();
                // despecialise the ability
                player.GetComponent <SpecialisedAbilityList>().DespecialiseAbility(openSkillTree.ability);
                // play a sound
                UISounds.playSound(UISounds.UISoundLabel.Despecialise);
                // update tooltip mana costs
                AbilityTooltip.updateManaCosts(openSkillTree.ability);
            }
            uiBase.closeSkillTrees();
            uiBase.closeSpecialisationSelection();
        }
    }
Example #3
0
    public override void OnKeyUp(KButtonEvent e)
    {
        bool flag = false;

        if (e.IsAction(Action.MouseRight))
        {
            GetMouseHoverInfo(out bool is_hovering_screen, out bool is_hovering_button);
            if (is_hovering_screen)
            {
                flag = true;
                if (!is_hovering_button)
                {
                    UISounds.PlaySound(UISounds.Sound.Negative);
                }
                if (!e.Consumed)
                {
                    e.TryConsume(Action.MouseRight);
                }
            }
        }
        if (!flag)
        {
            base.OnKeyUp(e);
        }
    }
    public void clicked()
    {
        if (AbilityDragHandler.dragging)
        {
            return;
        }

        if (ability)
        {
            openSkillTree();
            //int abilityNumber = AbilityPanelManager.instance.abilityClicked;
            //// abilityNumber is 0 if this was opened with the S key
            //if (abilityNumber == 0) { openSkillTree(); }
            //// otherise it was opened by clicking on an ability in the ability bar
            //else
            //{
            //    list.GetComponent<AbilityList>().abilities[abilityNumber - 1] = ability;
            //    UIBase.instance.closeSkills();
            //}
        }
        else
        {
            UIBase.instance.closeSkillTrees();
            UIBase.instance.closeSpecialisationSelection();
            openSkillSelection();
        }

        // play a sound
        UISounds.playSound(UISounds.UISoundLabel.Confirm);
    }
Example #5
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // TODO: use this.Content to load your game content here
            int Channel = Bass.BASS_StreamCreateFile("Sounds\\BUTTON.WAV", 0, 0, BASSFlag.BASS_DEFAULT);

            UISounds.AddSound(new UISound(0x01, Channel));

            GameFacade.MainFont = new TSOClient.Code.UI.Framework.Font();
            GameFacade.MainFont.AddSize(10, Content.Load <SpriteFont>("Fonts/ProjectDollhouse_10px"));
            GameFacade.MainFont.AddSize(12, Content.Load <SpriteFont>("Fonts/ProjectDollhouse_12px"));
            GameFacade.MainFont.AddSize(14, Content.Load <SpriteFont>("Fonts/ProjectDollhouse_14px"));
            GameFacade.MainFont.AddSize(16, Content.Load <SpriteFont>("Fonts/ProjectDollhouse_16px"));

            GameFacade.SoundManager = new TSOClient.Code.Sound.SoundManager();
            GameFacade.GameThread   = Thread.CurrentThread;

            uiLayer  = new UILayer(this, Content.Load <SpriteFont>("ComicSans"), Content.Load <SpriteFont>("ComicSansSmall"));
            SceneMgr = new _3DLayer();
            SceneMgr.Initialize(GraphicsDevice);

            GameFacade.Controller     = new GameController();
            GameFacade.Screens        = uiLayer;
            GameFacade.Scenes         = SceneMgr;
            GameFacade.GraphicsDevice = GraphicsDevice;
            GameFacade.Cursor         = new CursorManager(this.Window);
            GameFacade.Cursor.Init(tso.content.Content.Get().GetPath(""));

            /** Init any computed values **/
            GameFacade.Init();

            GameFacade.Strings = new ContentStrings();
            GameFacade.Controller.StartLoading();
        }
 private void PlayHoverSound()
 {
     if (!((UnityEngine.Object)GetComponent <CellSelectionObject>() != (UnityEngine.Object)null))
     {
         UISounds.PlaySound(UISounds.Sound.Object_Mouseover);
     }
 }
 private void OnClick(int i)
 {
     UISounds.PlaySound(UISounds.Sound.ClickObject);
     if (this.onSelect != null)
     {
         this.onSelect(toggleInfo[i]);
     }
 }
Example #8
0
 public void OnTurnTick()
 {
     UISounds.GetUISounds().Play("ui_notification_turn_start");
     UILoadingScreenPanel.Get()?.SetVisible(false);          // was no `?`
     if (UIFrontendLoadingScreen.Get().gameObject.activeSelf)
     {
         UIFrontendLoadingScreen.Get().StartDisplayFadeOut();
     }
 }
 private void Sample(int cell)
 {
     UISounds.PlaySound(UISounds.Sound.ClickObject);
     SandboxToolParameterMenu.instance.settings.Element      = Grid.Element[cell];
     SandboxToolParameterMenu.instance.settings.Mass         = Mathf.Round(Grid.Mass[cell] * 100f) / 100f;
     SandboxToolParameterMenu.instance.settings.temperature  = Mathf.Round(Grid.Temperature[cell] * 10f) / 10f;
     SandboxToolParameterMenu.instance.settings.diseaseCount = Grid.DiseaseCount[cell];
     SandboxToolParameterMenu.instance.RefreshDisplay();
 }
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
    public void clicked()
    {
        UIBase ui = UIBase.instance;

        ui.openSkills();

        // play a sound
        UISounds.playSound(UISounds.UISoundLabel.Confirm);

        deactivate();
    }
Example #12
0
    public void Clicked()
    {
        // return if the player has not specialised in this ability
        SkillTree skillTree = tree as SkillTree;

        if (skillTree)
        {
            if (!PlayerFinder.getPlayer().GetComponent <SpecialisedAbilityList>().abilities.Contains(skillTree.ability))
            {
                return;
            }
        }

        // check if there is a spare point and this is not at max points
        if ((nodeType == nodeRequirementType.axis && tree.unspentAxisPoints > 0) || (nodeType == nodeRequirementType.node && tree.unspentPoints > 0))
        {
            if (pointsAllocated < maxPoints || maxPoints < 0)
            {
                // if the requirements are met then allocate the point
                if (requirementsMet())
                {
                    pointsAllocated++;
                    if (nodeType == nodeRequirementType.node)
                    {
                        tree.unspentPoints--;
                    }
                    if (nodeType == nodeRequirementType.axis)
                    {
                        tree.unspentAxisPoints--;
                    }
                    tree.updateMutator();
                    updateText();
                    // play a sound
                    UISounds.playSound(UISounds.UISoundLabel.AllocateNode);
                    // update mana costs on tooltips
                    SkillTree st = tree as SkillTree;
                    if (st && st.ability)
                    {
                        AbilityTooltip.updateManaCosts(st.ability);
                    }
                    // update the node progression (for respeccing)
                    if (tree as CharacterTree)
                    {
                        SkillSavingManager.instance.pushToNodePogression(nodeID);
                    }
                }
            }
        }

        // save
        SkillSavingManager.instance.saveNodeData(this);
        PlayerFinder.getPlayer().GetComponent <CharacterDataTracker>().SaveCharacterData();
    }
    public void clicked()
    {
        UIBase ui = UIBase.instance;

        if (ui)
        {
            ui.openPassiveTree(true);

            // play a sound
            UISounds.playSound(UISounds.UISoundLabel.Confirm);

            deactivate();
        }
    }
Example #14
0
    private void OpenCategoryPanel(ToggleInfo toggle_info, bool play_sound = true)
    {
        HashedString plan_category = (HashedString)toggle_info.userData;

        ClearButtons();
        buildingGroupsRoot.gameObject.SetActive(true);
        activeCategoryInfo = toggle_info;
        if (play_sound)
        {
            UISounds.PlaySound(UISounds.Sound.ClickObject);
        }
        BuildButtonList(plan_category, GroupsTransform.gameObject);
        PlanCategoryLabel.text = activeCategoryInfo.text.ToUpper();
        buildingGroupsRoot.GetComponent <ExpandRevealUIContent>().Expand(null);
    }
Example #15
0
    public void clicked()
    {
        UIBase uiBase = UIBase.instance;

        if (uiBase && uiBase.openSkillTrees.Count > 0)
        {
            SkillTree  openSKillTree = uiBase.openSkillTrees[0];
            GameObject player        = PlayerFinder.getPlayer();
            if (openSKillTree && player && player.GetComponent <SpecialisedAbilityList>())
            {
                player.GetComponent <SpecialisedAbilityList>().SpecialiseIfThereIsAFreeSlot(openSKillTree.ability);
                // play a sound
                UISounds.playSound(UISounds.UISoundLabel.Specialise);
            }
            uiBase.closeSkillTrees();
            openSKillTree.open();
            uiBase.closeSpecialisationSelection();
        }
    }
    protected override void OnPaintCell(int cell, int distFromOrigin)
    {
        base.OnPaintCell(cell, distFromOrigin);
        bool flag = false;

        foreach (Pickupable item in Components.Pickupables.Items)
        {
            if (!((Object)item.storage != (Object)null) && Grid.PosToCell(item) == cell && (Object)Components.LiveMinionIdentities.Items.Find((MinionIdentity match) => (Object)match.gameObject == (Object)item.gameObject) == (Object)null)
            {
                if (!flag)
                {
                    UISounds.PlaySound(UISounds.Sound.Negative);
                    PopFXManager.Instance.SpawnFX(PopFXManager.Instance.sprite_Negative, UI.SANDBOXTOOLS.CLEARFLOOR.DELETED, item.transform, 1.5f, false);
                    flag = true;
                }
                Util.KDestroyGameObject(item.gameObject);
            }
        }
    }
 public void clicked()
 {
     // specialise in the ability
     if (specialisationPanelmanager)
     {
         player.GetComponent <SpecialisedAbilityList>().Specialise(ability, specialisationPanelmanager.slotClicked);
     }
     // close the selection panel
     UIBase.instance.closeSpecialisationSelection();
     // open the relevant skill tree
     foreach (SkillTree skillTree in SkillTree.all)
     {
         if (skillTree.ability == ability)
         {
             skillTree.open();
         }
     }
     // play a sound
     UISounds.playSound(UISounds.UISoundLabel.Specialise);
 }
 private void Place(int cell)
 {
     if (Grid.IsValidBuildingCell(cell))
     {
         if (SandboxToolParameterMenu.instance.settings.Entity.PrefabID() == (Tag)MinionConfig.ID)
         {
             SpawnMinion();
         }
         else if ((Object)SandboxToolParameterMenu.instance.settings.Entity.GetComponent <Building>() != (Object)null)
         {
             BuildingDef def = SandboxToolParameterMenu.instance.settings.Entity.GetComponent <Building>().Def;
             def.Build(cell, Orientation.Neutral, null, def.DefaultElements(), 298.15f, true, -1f);
         }
         else
         {
             GameObject gameObject = GameUtil.KInstantiate(Assets.GetPrefab(SandboxToolParameterMenu.instance.settings.Entity.PrefabTag), Grid.CellToPosCBC(currentCell, Grid.SceneLayer.Creatures), Grid.SceneLayer.Creatures, null, 0);
             gameObject.SetActive(true);
         }
         UISounds.PlaySound(UISounds.Sound.ClickObject);
     }
 }
Example #19
0
    public void clicked(Ability ability = null)
    {
        UIBase ui = UIBase.instance;

        ui.openSkills();
        AbilityPanelManager.instance.abilityClicked = 0;
        // open the relevant tree
        if (ability != null)
        {
            foreach (SkillTree tree in SkillTree.all)
            {
                if (tree.ability == ability)
                {
                    tree.open();
                }
            }
        }

        // play a sound
        UISounds.playSound(UISounds.UISoundLabel.Confirm);

        deactivate();
    }
Example #20
0
    public static void UISound(UISounds soundtype)
    {
        switch (soundtype)
        {
        case UISounds.Click:
            EventManager.TriggerEvent("UIClick");
            break;

        case UISounds.Release:
            EventManager.TriggerEvent("UIRelease");
            break;

        case UISounds.Select:
            EventManager.TriggerEvent("UISelect");
            break;

        case UISounds.Success:
            EventManager.TriggerEvent("UISuccess");
            break;

        case UISounds.Error:
            EventManager.TriggerEvent("UIError");
            break;

        case UISounds.Notification:
            EventManager.TriggerEvent("UINotification");
            break;

        case UISounds.Equip:
            EventManager.TriggerEvent("UIEquip");
            break;

        case UISounds.Destroy:
            EventManager.TriggerEvent("UIDestroy");
            break;
        }
    }
Example #21
0
    public void clicked()
    {
        if (AbilityDragHandler.dragging)
        {
            return;
        }

        int abilityNumber = AbilityPanelManager.instance.abilityClicked;

        // abilityNumber is 0 if this was opened with the S key
        if (abilityNumber == 0)
        {
            // play a sound
            UISounds.playSound(UISounds.UISoundLabel.Confirm);
            // open the tree
            openSkillTree();
        }
        // otherise it was opened by clicking on an ability in the ability bar
        else
        {
            player.GetComponent <AbilityList>().abilities[abilityNumber - 1] = ability;
            UIBase.instance.closeSkills();
        }
    }
Example #22
0
 public override void OnLeftClickDown(Vector3 cursor_pos)
 {
     UISounds.PlaySound(UISounds.Sound.Negative);
     base.OnLeftClickDown(cursor_pos);
 }
    public void OnEndDrag(PointerEventData eventData)
    {
        safeToClearVariables = true;
        StartCoroutine(clearDragVariables());

        // find the ability
        player = PlayerFinder.getPlayer();
        if (GetComponent <AbilityPanelIcon>())
        {
            ability = GetComponent <AbilityPanelIcon>().ability;
        }
        else if (GetComponent <SpecialisedAbilityIcon>() && player.GetComponent <SpecialisedAbilityList>().abilities.Count > GetComponent <SpecialisedAbilityIcon>().abilityNumber&&
                 player.GetComponent <SpecialisedAbilityList>().abilities[GetComponent <SpecialisedAbilityIcon>().abilityNumber] != null)
        {
            ability = player.GetComponent <SpecialisedAbilityList>().abilities[GetComponent <SpecialisedAbilityIcon>().abilityNumber];
        }

        // if the ability is null just return
        if (ability == null)
        {
            transform.position = startPos;
            return;
        }

        // try to apply to an ability bar icon
        AbilityBarIcon[] abilityIcons = AbilityBarIcon.all.ToArray();
        if (abilityIcons != null)
        {
            AbilityBarIcon selectedIcon = abilityIcons [0];
            foreach (AbilityBarIcon a in abilityIcons)
            {
                if (Mathf.Abs(a.transform.position.x - eventData.position.x) < Mathf.Abs(selectedIcon.transform.position.x - eventData.position.x))
                {
                    selectedIcon = a;
                }
            }
            if (Mathf.Abs(selectedIcon.transform.position.x - eventData.position.x) < 30.0f)
            {
                abilityNum = selectedIcon.abilityNumber;
                player.GetComponent <AbilityList> ().abilities [abilityNum - 1] = ability;

                // play a sound
                UISounds.playSound(UISounds.UISoundLabel.Confirm);
            }
        }

        // try to apply to a specialisation slot
        if (!specialisedIconHandler)
        {
            // check if this ability has a tree
            bool abilityHasTree = false;
            foreach (SkillTree tree in SkillTree.all)
            {
                if (tree.ability == ability)
                {
                    abilityHasTree = true;
                }
            }

            if (abilityHasTree && !player.GetComponent <SpecialisedAbilityList>().abilities.Contains(ability))
            {
                // only look at open specialisation slots
                List <SpecialisedAbilityIcon> specialisedIcons = new List <SpecialisedAbilityIcon>();
                specialisedIcons.AddRange(SpecialisedAbilityIcon.all);
                specialisedIcons.RemoveAll(x => x.ability != null);
                specialisedIcons.RemoveAll(x => x.locked == true);

                if (specialisedIcons.Count > 0)
                {
                    SpecialisedAbilityIcon selectedIcon = specialisedIcons[0];
                    foreach (SpecialisedAbilityIcon icon in specialisedIcons)
                    {
                        if (Mathf.Abs(icon.transform.position.x - eventData.position.x) < Mathf.Abs(selectedIcon.transform.position.x - eventData.position.x))
                        {
                            selectedIcon = icon;
                        }
                    }

                    if (Mathf.Abs(selectedIcon.transform.position.x - eventData.position.x) < 30.0f)
                    {
                        player.GetComponent <SpecialisedAbilityList>().Specialise(ability, selectedIcon.abilityNumber);
                        // close the selection panel
                        UIBase.instance.closeSpecialisationSelection();
                        // open the relevant skill tree
                        foreach (SkillTree skillTree in SkillTree.all)
                        {
                            if (skillTree.ability == ability)
                            {
                                skillTree.open();
                            }
                        }
                        // play a sound
                        UISounds.playSound(UISounds.UISoundLabel.Specialise);
                    }
                }
            }
        }



        //alternate way of doing this, probably better if to find what is under the curser than the above functional way
        //this is dependant on what order objects are in, in the hierarchy

        /*
         * foreach (GameObject g in eventData.hovered) {
         *      if (g.transform.GetComponent<AbilityBarIcon> () != null) {
         *              player = GameObject.FindGameObjectWithTag ("Player");
         *              abilityNum = g.transform.GetComponent<AbilityBarIcon> ().abilityNumber;
         *              ability = GetComponent<AbilityPanelIcon> ().ability;
         *              player.GetComponent<AbilityList>().abilities[abilityNum - 1] = ability;
         *              break;
         *      }
         * }
         */
        transform.position = startPos;
    }
Example #24
0
 protected override void Start()
 {
     base.Start();
     sounds = GameObject.Find("MainCanvas").GetComponent <UISounds>();
 }
Example #25
0
 /// <summary>
 /// Play UI sounds
 /// </summary>
 /// <param name="id"></param>
 public void PlayUISound(int id)
 {
     PlaySound(UISounds.GetSound(id));
 }
Example #26
0
 void Awake()
 {
     instance = this;
 }
Example #27
0
 void Awake()
 {
     instance = this;
 }