Browse Source

Add proper button navigation

master
Devin 4 years ago
parent
commit
d872f95623
  1. 43
      Assets/Resources/PlayerArmor.asset
  2. 8
      Assets/Resources/PlayerArmor.asset.meta
  3. 17
      Assets/Resources/PlayerInventory.asset
  4. 8
      Assets/Resources/PlayerInventory.asset.meta
  5. 47
      Assets/Resources/PlayerStarterWeapon.asset
  6. 8
      Assets/Resources/PlayerStarterWeapon.asset.meta
  7. 14812
      Assets/Scenes/NewShop.unity
  8. 34
      Assets/Scripts/Shop/Components/ShopNavButton.cs
  9. 11
      Assets/Scripts/Shop/Components/ShopNavButton.cs.meta

43
Assets/Resources/PlayerArmor.asset

@ -0,0 +1,43 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ebeacc5773329254488339277dadfae7, type: 3}
m_Name: PlayerArmor
m_EditorClassIdentifier:
Rarity: 16777215
DefenseMin: 5
DefenseMax: 8
PriceMin: 150
PriceMax: 300
Items:
- Sprite: {fileID: 6077338267653451029, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Mooscles
Description: If you drink the milk, your mooscles will be stronk, and you can
defend yourself with them.
Bonus: 0
- Sprite: {fileID: -7323674943459820596, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Champion's Tunic
Description: This blue tunic seems to have belonged to a fallen hero hundreds
of years ago.
Bonus: 3
- Sprite: {fileID: -8650232248937032532, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Tunic of Time
Description: This green tunic may look familiar.
Bonus: 4
- Sprite: {fileID: -4790045407390419966, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Hero's Boots
Description: These boots may look familiar.
Bonus: 2
Amount: 2

8
Assets/Resources/PlayerArmor.asset.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7ad318ea23becb84fb732ea2b14bda02
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

17
Assets/Resources/PlayerInventory.asset

@ -0,0 +1,17 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: be184c10b845d1044abbc1c356837cac, type: 3}
m_Name: PlayerInventory
m_EditorClassIdentifier:
ItemFactories:
- {fileID: 11400000, guid: ae9b2463f66cb6940991ebee46f0a51e, type: 2}
- {fileID: 11400000, guid: 7ad318ea23becb84fb732ea2b14bda02, type: 2}

8
Assets/Resources/PlayerInventory.asset.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: aed79a62cfb941741bd92ea0a643b752
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

47
Assets/Resources/PlayerStarterWeapon.asset

@ -0,0 +1,47 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ea9644082b1c77a44849c5b6af28eb4f, type: 3}
m_Name: PlayerStarterWeapon
m_EditorClassIdentifier: SAShop::ProceduralWeaponFactory
Rarity: 16777215
DamageMin: 2
DamageMax: 7
PriceMin: 50
PriceMax: 100
Items:
- Sprite: {fileID: -6229739577819397656, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Wooden Sword
Description: This wooden sword is quite awful!
Bonus: 0
- Sprite: {fileID: -4063295180217184869, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Basic Sword
Description: A basic common sword, which is not particularly useful in battle,
but keeps you safe from wildlife.
Bonus: 2
- Sprite: {fileID: -7651958066320933242, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Weird Sword
Description: This sword is kind of weird. But it seems to do the job!
Bonus: 1
- Sprite: {fileID: 206911327383899660, guid: b00993d063fbc4a87983115070f6145c, type: 3}
Name: Dagger
Description: Small dagger, easy to use and deadly, but with little range.
Bonus: 1
- Sprite: {fileID: -8295029410813222302, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Wood Axe
Description: This axe was built to chop down trees. Apparently it also chops
down your enemies!
Bonus: 3
Amount: 1

8
Assets/Resources/PlayerStarterWeapon.asset.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ae9b2463f66cb6940991ebee46f0a51e
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

14812
Assets/Scenes/NewShop.unity

File diff suppressed because it is too large

34
Assets/Scripts/Shop/Components/ShopNavButton.cs

@ -0,0 +1,34 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ShopNavButton : MonoBehaviour
{
private Image[] highlights;
private void Start()
{
var buttons = GetComponentsInChildren<Button>(true);
List<Image> allHighlights = new List<Image>();
foreach (var button in buttons)
{
for(int i = 0; i < button.transform.childCount; i++)
{
var img = button.transform.GetChild(i).GetComponent<Image>();
if(img != null)
allHighlights.Add(img);
}
}
highlights = allHighlights.ToArray();
}
public void SetActiveButton(Button active)
{
foreach (var highlight in highlights)
{
highlight.gameObject.SetActive(highlight.transform.parent == active.transform);
}
}
}

11
Assets/Scripts/Shop/Components/ShopNavButton.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9cd274dfbae07294b9de965f97b72a3b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Loading…
Cancel
Save