Compare commits
2 Commits
598f279303
...
2c130fddb2
Author | SHA1 | Date | |
---|---|---|---|
2c130fddb2 | |||
98fbf1f376 |
@ -1003,6 +1003,7 @@ GameObject:
|
|||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 4284489241738703987}
|
- component: {fileID: 4284489241738703987}
|
||||||
- component: {fileID: 4284489241738703984}
|
- component: {fileID: 4284489241738703984}
|
||||||
|
- component: {fileID: 44085837872364204}
|
||||||
m_Layer: 5
|
m_Layer: 5
|
||||||
m_Name: AssetsPanel
|
m_Name: AssetsPanel
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@ -1058,6 +1059,22 @@ MonoBehaviour:
|
|||||||
m_ChildScaleWidth: 0
|
m_ChildScaleWidth: 0
|
||||||
m_ChildScaleHeight: 0
|
m_ChildScaleHeight: 0
|
||||||
m_ReverseArrangement: 0
|
m_ReverseArrangement: 0
|
||||||
|
--- !u!114 &44085837872364204
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4284489241738703986}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 21c091287355b794bba54c08c0a11ab5, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
Stone: {fileID: 4284489241411994666}
|
||||||
|
Coin: {fileID: 4284489241406162018}
|
||||||
|
Ore: {fileID: 4284489240705305073}
|
||||||
|
Forging: {fileID: 4284489241848196371}
|
||||||
--- !u!1 &4284489241775518536
|
--- !u!1 &4284489241775518536
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
52
meng_yao/Assets/script/Panel/AssestPanel.cs
Normal file
52
meng_yao/Assets/script/Panel/AssestPanel.cs
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
public class AssestPanel : MonoBehaviour
|
||||||
|
{
|
||||||
|
public static AssestPanel instance;
|
||||||
|
|
||||||
|
public Text Stone;
|
||||||
|
public Text Coin;
|
||||||
|
public Text Ore;
|
||||||
|
public Text Forging;
|
||||||
|
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
instance = this;
|
||||||
|
Stone.text = PlayerManager.Instance.Stones.ToString();
|
||||||
|
Forging.text=PlayerManager.Instance.Forging.ToString();
|
||||||
|
Coin.text=PlayerManager.Instance.Coins.ToString();
|
||||||
|
Ore.text=PlayerManager.Instance.Ore.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetStoneText(float num)
|
||||||
|
{
|
||||||
|
if (Stone!=null)
|
||||||
|
{
|
||||||
|
Stone.text=num.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public void SetCoinText(float num)
|
||||||
|
{
|
||||||
|
if (Coin != null)
|
||||||
|
{
|
||||||
|
Coin.text = num.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void SetOreText(float num)
|
||||||
|
{
|
||||||
|
if (Ore != null)
|
||||||
|
{
|
||||||
|
Ore.text = num.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void SetForgingText(float num)
|
||||||
|
{
|
||||||
|
if (Forging != null)
|
||||||
|
{
|
||||||
|
Forging.text = num.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
meng_yao/Assets/script/Panel/AssestPanel.cs.meta
Normal file
11
meng_yao/Assets/script/Panel/AssestPanel.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 21c091287355b794bba54c08c0a11ab5
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
8
meng_yao/Assets/script/Player.meta
Normal file
8
meng_yao/Assets/script/Player.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e1986fcddfc31824ebdd1b29797b201f
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
83
meng_yao/Assets/script/Player/PlayerManager.cs
Normal file
83
meng_yao/Assets/script/Player/PlayerManager.cs
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public enum MoneyType {
|
||||||
|
|
||||||
|
Stones,//钻石
|
||||||
|
Forging,//锻造
|
||||||
|
Coins,//金币
|
||||||
|
Ore//矿石
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class PlayerManager
|
||||||
|
{
|
||||||
|
private static PlayerManager _instance;
|
||||||
|
public static PlayerManager Instance
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_instance == null)
|
||||||
|
{
|
||||||
|
_instance = new PlayerManager();
|
||||||
|
|
||||||
|
}
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public float Stones = 100;
|
||||||
|
public float Forging = 100;
|
||||||
|
public float Coins = 100;
|
||||||
|
public float Ore = 100;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void SetMoney(MoneyType type,float num)
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case MoneyType.Stones:
|
||||||
|
if ((Stones + num) < 0)
|
||||||
|
{
|
||||||
|
Promptmgr.Instance.PromptBubble("砖石不足!!!",Color.black,Color.red);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Stones += num;
|
||||||
|
AssestPanel.instance.SetStoneText(Stones);
|
||||||
|
break;
|
||||||
|
case MoneyType.Forging:
|
||||||
|
if((Forging + num) < 0)
|
||||||
|
{
|
||||||
|
Promptmgr.Instance.PromptBubble("锻造币不足!!!", Color.black, Color.red);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Forging += num;
|
||||||
|
AssestPanel.instance.SetForgingText(Forging);
|
||||||
|
break;
|
||||||
|
case MoneyType.Coins:
|
||||||
|
if ((Coins + num) < 0)
|
||||||
|
{
|
||||||
|
Promptmgr.Instance.PromptBubble("锻造币不足!!!", Color.black, Color.red);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Coins += num;
|
||||||
|
AssestPanel.instance.SetCoinText(Coins);
|
||||||
|
break;
|
||||||
|
case MoneyType.Ore:
|
||||||
|
if ((Ore + num) < 0)
|
||||||
|
{
|
||||||
|
Promptmgr.Instance.PromptBubble("矿石不足!!!", Color.black, Color.red);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Ore += num;
|
||||||
|
AssestPanel.instance.SetOreText(Ore);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
meng_yao/Assets/script/Player/PlayerManager.cs.meta
Normal file
11
meng_yao/Assets/script/Player/PlayerManager.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 97ab4196e439a65469b332d791a21c21
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using DG.Tweening;
|
using DG.Tweening;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
|
|
||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
public class Path
|
public class Path
|
||||||
{
|
{
|
||||||
@ -43,11 +42,14 @@ public class landContorl : MonoBehaviour
|
|||||||
|
|
||||||
public Transform Btntrans;
|
public Transform Btntrans;
|
||||||
|
|
||||||
|
public float FishPrice;
|
||||||
|
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
|
FishPrice = 10;
|
||||||
|
|
||||||
|
|
||||||
if (goldshop == null)
|
if (goldshop == null)
|
||||||
{
|
{
|
||||||
@ -78,8 +80,9 @@ public class landContorl : MonoBehaviour
|
|||||||
Promptmgr.Instance.PromptBubble("´¬ÒѾÓÐÁË",Color.black,Color.red);
|
Promptmgr.Instance.PromptBubble("´¬ÒѾÓÐÁË",Color.black,Color.red);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Debug.LogError("쇱꿎繫법");
|
//Debug.LogError("쇱꿎繫법");
|
||||||
Debug.LogError("왱풀쭉서");
|
//Debug.LogError("왱풀쭉서");
|
||||||
|
PlayerManager.Instance.SetMoney(MoneyType.Stones, -FishPrice);
|
||||||
fishMan = GameObject.Instantiate(fishManPrefab);
|
fishMan = GameObject.Instantiate(fishManPrefab);
|
||||||
//fishMan.transform.SetParent(startPos);
|
//fishMan.transform.SetParent(startPos);
|
||||||
fishMan.transform.position = startPos.position;
|
fishMan.transform.position = startPos.position;
|
||||||
|
Loading…
Reference in New Issue
Block a user