Upgrade + Info Button on selection

This commit is contained in:
Sewmina
2022-04-09 21:28:39 +05:30
parent 0e2daa84ff
commit 32b942bda8
8 changed files with 2463 additions and 761 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.37311992, g: 0.38074034, b: 0.35872713, a: 1}
m_IndirectSpecularColor: {r: 0.37311953, g: 0.38074014, b: 0.35872743, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
@@ -123,6 +123,140 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &9307274
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 9307275}
- component: {fileID: 9307277}
- component: {fileID: 9307276}
m_Layer: 5
m_Name: ForgotPassOut
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &9307275
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9307274}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1899654636}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -0.000029564, y: 25}
m_SizeDelta: {x: 350.402, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &9307276
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9307274}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Authentication Error
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4278190335
m_fontColor: {r: 1, g: 0, b: 0, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 36
m_fontSizeBase: 36
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 1
m_HorizontalAlignment: 1
m_VerticalAlignment: 256
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: -1.1379088, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!222 &9307277
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9307274}
m_CullTransparentMesh: 1
--- !u!1 &22093552
GameObject:
m_ObjectHideFlags: 0
@@ -152,6 +286,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 202873371}
- {fileID: 1899654636}
m_Father: {fileID: 422775473}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -173,6 +308,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
Re: {fileID: 202873370}
AuthError: {fileID: 1899654635}
--- !u!1 &114996532
GameObject:
m_ObjectHideFlags: 0
@@ -3794,10 +3930,12 @@ MonoBehaviour:
m_EditorClassIdentifier:
login_username: {fileID: 1941771122}
login_password: {fileID: 1721268881}
rememberMe: {fileID: 1689520630}
loginBtn: {fileID: 1119663638}
reg_username: {fileID: 1527888704}
reg_password: {fileID: 1819860695}
regBtn: {fileID: 120103866}
otherUI: {fileID: 22093554}
--- !u!4 &1341947405
Transform:
m_ObjectHideFlags: 0
@@ -6012,6 +6150,42 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1895524956}
m_CullTransparentMesh: 0
--- !u!1 &1899654635
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1899654636}
m_Layer: 5
m_Name: AuthError
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &1899654636
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1899654635}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 9307275}
m_Father: {fileID: 22093553}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &1938596820
GameObject:
m_ObjectHideFlags: 0

View File

@@ -8,11 +8,14 @@ public class LoginManager : MonoBehaviour
{
public TMP_InputField login_username;
public TMP_InputField login_password;
public Toggle rememberMe;
public Button loginBtn;
public TMP_InputField reg_username;
public TMP_InputField reg_password;
public Button regBtn;
public OtherUIbuttons otherUI;
void Start()
{
loginBtn.onClick.AddListener(OnLoginClicked);
@@ -35,11 +38,17 @@ public class LoginManager : MonoBehaviour
public void OnLoginClicked(){
if(login_username.text.Length < 2){
MessageDialogInstance.messageDialog.ShowDialog("Error", "Please use a valid Username (should be more than 2 characters)");
if(otherUI!=null){
otherUI.ErrorAuth();
}
// MessageDialogInstance.messageDialog.ShowDialog("Error", "Please use a valid Username (should be more than 2 characters)");
return;
}
if(login_password.text.Length < 5){
MessageDialogInstance.messageDialog.ShowDialog("Error", "Please use a Strong password (should be more than 5 characters)");
if(otherUI!=null){
otherUI.ErrorAuth();
}
// MessageDialogInstance.messageDialog.ShowDialog("Error", "Please use a Strong password (should be more than 5 characters)");
return;
}
@@ -71,9 +80,10 @@ public class LoginManager : MonoBehaviour
Debug.Log(www.text);
if (www.text[0] == '0')
{
if(rememberMe.isOn){
PlayerPrefs.SetString("username", login_username.text);
PlayerPrefs.SetString("password", login_password.text);
PlayerPrefs.Save();
PlayerPrefs.Save();}
DBmanager.username = login_username.text;
DBmanager.SetGems(int.Parse(www.text.Split('\t')[2]),true);
DBmanager.SetCoins(int.Parse(www.text.Split('\t')[1]),true);

View File

@@ -16,7 +16,7 @@ LightingSettings:
m_AlbedoBoost: 1
m_IndirectOutputScale: 1
m_UsingShadowmask: 0
m_BakeBackend: 2
m_BakeBackend: 1
m_LightmapMaxSize: 128
m_BakeResolution: 20
m_Padding: 2

View File

@@ -6,10 +6,17 @@ using TMPro;
public class OtherUIbuttons : MonoBehaviour
{
public GameObject Re;
public GameObject AuthError;
public void forgotPass()
{
Re.SetActive(true);
AuthError.SetActive(false);
}
public void ErrorAuth(){
AuthError.SetActive(true);
Re.SetActive(false);
}
}

View File

@@ -7,17 +7,27 @@ public class SelectedItemMenu : MonoBehaviour
{
public Text nameTxt;
public Button upgradeBtn;
public Button infoBtn;
public UpgradeMenuItem[] menus;
void Start()
{
upgradeBtn.onClick.AddListener(OnUpgradeClicked);
infoBtn.onClick.AddListener(OnInfoClicked);
gameObject.SetActive(false);
}
void OnUpgradeClicked(){
//int relatedMenuIndex = -1;
Debug.Log("Opening Upgrade Menu for : " + Selector.selectedBuilding.buildingData.name);
for(int i = 0; i < menus.Length; i++){
menus[i].menuObject.SetActive(menus[i].relatedBuildings.Contains(Selector.selectedBuilding.buildingData));
menus[i].upgradeMenu.SetActive(menus[i].relatedBuildings.Contains(Selector.selectedBuilding.buildingData));
}
}
void OnInfoClicked(){
Debug.Log("Opening Info Menu for : " + Selector.selectedBuilding.buildingData.name);
for(int i = 0; i < menus.Length; i++){
menus[i].infoMenu.SetActive(menus[i].relatedBuildings.Contains(Selector.selectedBuilding.buildingData));
}
}
}
@@ -26,6 +36,7 @@ public class SelectedItemMenu : MonoBehaviour
[System.Serializable]
public class UpgradeMenuItem{
public GameObject menuObject;
public GameObject upgradeMenu;
public GameObject infoMenu;
public List<BuildingData> relatedBuildings;
}