Selling Functionality, Picking up items, Basic computer
This commit is contained in:
8
Assets/HUD/ComputerScreen.meta
Normal file
8
Assets/HUD/ComputerScreen.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e7b4e677e8686b6439797dddb7b0451b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/HUD/ComputerScreen/ComputerScreen.uxml
Normal file
8
Assets/HUD/ComputerScreen/ComputerScreen.uxml
Normal file
@@ -0,0 +1,8 @@
|
||||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
|
||||
<ui:Template name="SellEntry" src="project://database/Assets/HUD/ComputerScreen/SellEntry.uxml?fileID=9197481963319205126&guid=21f89b660ed43af43ae41053197365d0&type=3#SellEntry" />
|
||||
<ui:VisualElement style="flex-grow: 1; background-color: rgb(255, 255, 255); width: 75%; align-self: center; margin-top: 50px; margin-bottom: 50px; flex-direction: row;">
|
||||
<ui:Instance template="SellEntry" name="SellEntry" />
|
||||
<ui:Instance template="SellEntry" name="SellEntry" />
|
||||
<ui:Instance template="SellEntry" name="SellEntry" />
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
10
Assets/HUD/ComputerScreen/ComputerScreen.uxml.meta
Normal file
10
Assets/HUD/ComputerScreen/ComputerScreen.uxml.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 591d97b1528d4114b8513a09921d5537
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
||||
7
Assets/HUD/ComputerScreen/SellEntry.uxml
Normal file
7
Assets/HUD/ComputerScreen/SellEntry.uxml
Normal file
@@ -0,0 +1,7 @@
|
||||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False">
|
||||
<ui:VisualElement name="VisualElement" style="flex-grow: 1; width: initial; margin-top: 30px; margin-right: 30px; margin-bottom: 30px; margin-left: 30px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); border-top-width: 5px; border-right-width: 5px; border-bottom-width: 5px; border-left-width: 5px;">
|
||||
<ui:Label tabindex="-1" text="ITEMNAME" parse-escape-sequences="true" display-tooltip-when-elided="true" name="ItemName" style="align-self: auto; -unity-text-align: upper-center; font-size: 70%; margin-top: 15px; margin-right: 15px; margin-bottom: 15px; margin-left: 15px;" />
|
||||
<ui:VisualElement name="ItemImage" style="flex-grow: 1; width: auto; height: auto; background-image: url("project://database/Assets/HUD/ComputerScreen/prototype.png?fileID=2800000&guid=ad0f7eac80567534ab59a2864d336793&type=3#prototype"); -unity-background-scale-mode: scale-to-fit;" />
|
||||
<ui:Button text="Buy" parse-escape-sequences="true" display-tooltip-when-elided="true" name="BuyButton" style="margin-top: 50px; margin-bottom: 50px; padding-bottom: 20px; padding-top: 20px; margin-right: 25px; margin-left: 25px; font-size: 54px;" />
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
10
Assets/HUD/ComputerScreen/SellEntry.uxml.meta
Normal file
10
Assets/HUD/ComputerScreen/SellEntry.uxml.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 21f89b660ed43af43ae41053197365d0
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
||||
BIN
Assets/HUD/ComputerScreen/prototype.png
Normal file
BIN
Assets/HUD/ComputerScreen/prototype.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
114
Assets/HUD/ComputerScreen/prototype.png.meta
Normal file
114
Assets/HUD/ComputerScreen/prototype.png.meta
Normal file
@@ -0,0 +1,114 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ad0f7eac80567534ab59a2864d336793
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/HUD/ItemSellScreen.meta
Normal file
8
Assets/HUD/ItemSellScreen.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 06355872d664ee14ca5c9bc810297be7
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
39
Assets/HUD/ItemSellScreen/ItemSellScreen.asset
Normal file
39
Assets/HUD/ItemSellScreen/ItemSellScreen.asset
Normal file
@@ -0,0 +1,39 @@
|
||||
%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: 19101, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_Name: ItemSellScreen
|
||||
m_EditorClassIdentifier:
|
||||
themeUss: {fileID: -4733365628477956816, guid: 63ef76e262723ce4790482d0537e3d6b,
|
||||
type: 3}
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_ScaleMode: 0
|
||||
m_ReferenceSpritePixelsPerUnit: 100
|
||||
m_Scale: 1
|
||||
m_ReferenceDpi: 120
|
||||
m_FallbackDpi: 96
|
||||
m_ReferenceResolution: {x: 1200, y: 800}
|
||||
m_ScreenMatchMode: 0
|
||||
m_Match: 0
|
||||
m_SortingOrder: 0
|
||||
m_TargetDisplay: 0
|
||||
m_ClearDepthStencil: 1
|
||||
m_ClearColor: 0
|
||||
m_ColorClearValue: {r: 0, g: 0, b: 0, a: 0}
|
||||
m_DynamicAtlasSettings:
|
||||
m_MinAtlasSize: 64
|
||||
m_MaxAtlasSize: 4096
|
||||
m_MaxSubTextureSize: 64
|
||||
m_ActiveFilters: -1
|
||||
m_AtlasBlitShader: {fileID: 9101, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_RuntimeShader: {fileID: 9100, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_RuntimeWorldShader: {fileID: 9102, guid: 0000000000000000f000000000000000, type: 0}
|
||||
textSettings: {fileID: 0}
|
||||
8
Assets/HUD/ItemSellScreen/ItemSellScreen.asset.meta
Normal file
8
Assets/HUD/ItemSellScreen/ItemSellScreen.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c332681d8d6ed4b43a0db286dbc9ecd8
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
0
Assets/HUD/ItemSellScreen/ItemSellScreen.uss
Normal file
0
Assets/HUD/ItemSellScreen/ItemSellScreen.uss
Normal file
11
Assets/HUD/ItemSellScreen/ItemSellScreen.uss.meta
Normal file
11
Assets/HUD/ItemSellScreen/ItemSellScreen.uss.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 878bef87725804d40b00535fec3d61f9
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
|
||||
disableValidation: 0
|
||||
12
Assets/HUD/ItemSellScreen/SellItem.uxml
Normal file
12
Assets/HUD/ItemSellScreen/SellItem.uxml
Normal file
@@ -0,0 +1,12 @@
|
||||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False">
|
||||
<Style src="project://database/Assets/HUD/ItemSellScreen/ItemSellScreen.uss?fileID=7433441132597879392&guid=878bef87725804d40b00535fec3d61f9&type=3#ItemSellScreen" />
|
||||
<ui:VisualElement name="VisualElement" style="flex-grow: 1; width: 75%; align-self: center; margin-right: 0; margin-left: 0; padding-top: 0; padding-bottom: 0; background-color: rgb(255, 255, 255); padding-right: 0; padding-left: 0; height: auto; cursor: initial; margin-top: 50px; margin-bottom: 50px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); border-top-width: 10px; border-right-width: 10px; border-bottom-width: 10px; border-left-width: 10px;">
|
||||
<ui:Label tabindex="-1" text="ITEMNAME" parse-escape-sequences="true" display-tooltip-when-elided="true" name="ItemName" style="font-size: 93px; height: auto; width: auto; -unity-text-align: upper-center; margin-top: 30px; justify-content: flex-start;" />
|
||||
<ui:VisualElement style="flex-grow: 1; flex-direction: row; -unity-text-align: upper-center; align-items: center; justify-content: center; align-self: auto;">
|
||||
<ui:Label tabindex="-1" text="Paid Price:" parse-escape-sequences="true" display-tooltip-when-elided="true" style="font-size: 50px; height: auto; width: auto; -unity-text-align: middle-center; margin-top: 0; justify-content: flex-start; white-space: nowrap;" />
|
||||
<ui:Label tabindex="-1" text="100 Barkie" parse-escape-sequences="true" display-tooltip-when-elided="true" name="PriceLabel" style="font-size: 50px;" />
|
||||
</ui:VisualElement>
|
||||
<ui:TextField picking-mode="Ignore" label="Your Price" value="20" name="YourPriceInputfield" password="false" keyboard-type="DecimalPad" style="flex-direction: column; margin-right: 150px; margin-left: 150px; font-size: 48px; -unity-text-align: upper-center; margin-top: 100px; align-self: auto;" />
|
||||
<ui:Button text="Place for Sale" parse-escape-sequences="true" display-tooltip-when-elided="true" name="SellButton" style="margin-right: 150px; margin-left: 150px; padding-bottom: 50px; padding-top: 50px; margin-top: 105px; -unity-text-align: middle-center; justify-content: flex-start; align-items: stretch; align-self: auto; font-size: 72px; margin-bottom: 105px;" />
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
10
Assets/HUD/ItemSellScreen/SellItem.uxml.meta
Normal file
10
Assets/HUD/ItemSellScreen/SellItem.uxml.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6f1f93c5c9a999342ab6c4eaea371c0b
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
||||
50
Assets/HUD/ItemSellScreen/SellScreenController.cs
Normal file
50
Assets/HUD/ItemSellScreen/SellScreenController.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.UIElements;
|
||||
using Button = UnityEngine.UIElements.Button;
|
||||
|
||||
public class SellScreenController : MonoBehaviour {
|
||||
|
||||
private UIDocument _document;
|
||||
|
||||
private Label _itemNameLabel;
|
||||
private Label _paidPriceLabel;
|
||||
private TextField _YourPriceInputfield;
|
||||
|
||||
private SellCounter _counter;
|
||||
private Object _sellingObject;
|
||||
|
||||
|
||||
//Becase we set the gameobject to active false, we need to use Awake
|
||||
private void Awake() {
|
||||
_document = GetComponent<UIDocument>();
|
||||
_itemNameLabel = _document.rootVisualElement.Q<Label>("ItemName");
|
||||
_document.rootVisualElement.Q<Button>("SellButton").clicked += SellItem;
|
||||
|
||||
_paidPriceLabel = _document.rootVisualElement.Q<Label>("PriceLabel");
|
||||
_YourPriceInputfield = _document.rootVisualElement.Q<TextField>("YourPrice");
|
||||
|
||||
if (_itemNameLabel == null) {
|
||||
Debug.LogError("Item name not found");
|
||||
}
|
||||
}
|
||||
//TODO: ask how to do this, since the gameobjec that renders the ui is not active
|
||||
public void SetItem(SellCounter counter, Object @object) {
|
||||
_counter = counter;
|
||||
_sellingObject = @object;
|
||||
_paidPriceLabel.text = @object.ObjectSo.basePrice.ToString();
|
||||
_itemNameLabel.text = @object.ObjectSo.objectName;
|
||||
}
|
||||
|
||||
public void SellItem() {
|
||||
_counter.ConfirmSell(_sellingObject);
|
||||
HUDManager.Instance.HideCurrentHUD();
|
||||
//Sell the item
|
||||
//Trigger an event that the item was sold
|
||||
|
||||
Debug.Log("Selling: " + _itemNameLabel.text);
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/HUD/ItemSellScreen/SellScreenController.cs.meta
Normal file
11
Assets/HUD/ItemSellScreen/SellScreenController.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 52846a6aaec3a5b408d91c8153b93c04
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user