Commit 71fcfc86 authored by 王雪伟's avatar 王雪伟

加入修改地块图片脚本

parent fc9f5b4d
......@@ -1388,6 +1388,7 @@ GameObject:
- component: {fileID: 455528768202490609}
- component: {fileID: 455528768202490614}
- component: {fileID: 3603921452413514014}
- component: {fileID: 3038306697377462943}
m_Layer: 5
m_Name: Car
m_TagString: Untagged
......@@ -1504,6 +1505,44 @@ MonoBehaviour:
ImgList:
- {fileID: 455528767864126192}
- {fileID: 455528768893061780}
--- !u!114 &3038306697377462943
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 455528768202490612}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8650296310592fd468d8ce06e5f8d80f, type: 3}
m_Name:
m_EditorClassIdentifier:
PlantLandFruit: {fileID: 455528768893061780}
RewardLandFruit: {fileID: 455528767864126192}
PlantText: {fileID: 0}
FlyRewardFruit: {fileID: 2730660779215313333}
FlyRewardFruit2: {fileID: 8094320170044776814}
FlyRewardFruit3: {fileID: 6832790893050530142}
LandFruitSprites:
- {fileID: 21300000, guid: 06eed7c796a1a40cdaee2a224a648531, type: 3}
- {fileID: 21300000, guid: 07e7c47f587414ecfa2292dc9e01c603, type: 3}
- {fileID: 21300000, guid: 6b8454e4afd554842af5e7109dd3d69d, type: 3}
- {fileID: 21300000, guid: 3c82b7790f4b7429c8a54b7372c62967, type: 3}
- {fileID: 21300000, guid: ac0d415c55cd04dc0b490cab9d7cff7c, type: 3}
- {fileID: 21300000, guid: 910341a9fbd884676b784550cb8de6dd, type: 3}
- {fileID: 21300000, guid: 185b2ac2d371f4fa8a0dcdd11d330138, type: 3}
- {fileID: 21300000, guid: 9348b49f4f02846ae8f67eff9928d970, type: 3}
- {fileID: 21300000, guid: c62d3e98e84cc44b3b23dbdafe7125a7, type: 3}
FloatFruitSprites:
- {fileID: 21300000, guid: 47ddb0399e2684cf3884c6d6bdddf958, type: 3}
- {fileID: 21300000, guid: 72f865c0b00ad4541ae1a671aae1040a, type: 3}
- {fileID: 21300000, guid: 6cc4af9c8b9064107b6ea289c5733259, type: 3}
- {fileID: 21300000, guid: 9b89a9ec88f4842b3a619c1567897a5e, type: 3}
- {fileID: 21300000, guid: 5bfbf41c22713430fbfe0c71d1e0a026, type: 3}
- {fileID: 21300000, guid: f1cc32b6fcc8b4ec7a624085380dd608, type: 3}
- {fileID: 21300000, guid: ee2dc6b0cb7974ff5b77f2fe65a97d43, type: 3}
- {fileID: 21300000, guid: 8944be0946e714260912afb0aafb3ca5, type: 3}
- {fileID: 21300000, guid: fd5ece32e702d4c87b077c6ac5feb5fd, type: 3}
--- !u!1 &455528768205073271
GameObject:
m_ObjectHideFlags: 0
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// 动态设置地块的图标
/// </summary>
public class CarTypeControl : MonoBehaviour
{
[SerializeField]
public Image PlantLandFruit;//种植地块图片
[SerializeField]
public Image RewardLandFruit;//收获地块图片
public Text PlantText;
[SerializeField]
public Image FlyRewardFruit;//飞行收获水果
[SerializeField]
public Image FlyRewardFruit2;//飞行收获水果2
[SerializeField]
public Image FlyRewardFruit3;//飞行收获水果3
[SerializeField]
Sprite[] LandFruitSprites;
[SerializeField]
Sprite[] FloatFruitSprites;
private int m_LandPos;//地块ID
private CarDataControl mLandData;
private void Awake()
{
mLandData = GetComponent<CarDataControl>();
m_LandPos = mLandData.carId;
//EventCenter.AddListener<LandListData>(MyEventType.SET_FRUIT_TYPE, OnSetLandFruit);
}
private void OnDestroy()
{
//EventCenter.RemoveListener<LandListData>(MyEventType.SET_FRUIT_TYPE, OnSetLandFruit);
}
/// <summary>
/// 设置地块的种植物品
/// </summary>
/// <param name="arg"></param>
public void OnSetLandPlant(LandListData arg)
{
if (arg.landId == m_LandPos)
{
Debug.unityLogger.Log("种植物"+arg.landId);
if (arg.landPlantData != null)
{
Debug.unityLogger.Log("种植物" + arg.landPlantData.plantId);
}
Debug.unityLogger.Log("种植物"+m_LandPos);
////土地显示
//PlantLandFruit.sprite = LandFruitSprites[arg.landPlantData.plantId];//0-8
//RewardLandFruit.sprite = LandFruitSprites[arg.landPlantData.plantId];
////小的图片
//FlyRewardFruit.sprite = FloatFruitSprites[arg.landPlantData.plantId];
//FlyRewardFruit2.sprite = FloatFruitSprites[arg.landPlantData.plantId];
//FlyRewardFruit2.sprite = FloatFruitSprites[arg.landPlantData.plantId];
//种植物的名字
}
}
}
fileFormatVersion: 2
guid: 8650296310592fd468d8ce06e5f8d80f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -16,4 +16,6 @@ public class CarTypeImg : MonoBehaviour
car.sprite = CarImgList[arg - 1];
}
}
}
......@@ -31,6 +31,7 @@ public class CarUIControl : MonoBehaviour
public Text CarName,lockName;//待解锁的UI
public Text plantname, plantvalue;//待种植的UI
private CarTypeImg mCarImg;
private CarTypeControl mCarTypeImg;
private ParkingSpace mCarData;
private LandListData mlandData;
private Coroutine flyCoinTimeControl;
......@@ -47,6 +48,7 @@ public class CarUIControl : MonoBehaviour
private void Awake()
{
mCarImg = GetComponent<CarTypeImg>();
mCarTypeImg = GetComponent<CarTypeControl>();
m_Animator = img_speed_finish.GetComponent<Animator>();
EventCenter.AddListener<int>(MyEventType.ShowSpeedAnimal, showSpeedAnimal);
EventCenter.AddListener(MyEventType.EndSpeedAnimal, endSpeedAnimal);
......@@ -214,6 +216,7 @@ public class CarUIControl : MonoBehaviour
// unLockVideoObj.SetActive(false);
//}
mCarImg.OnSetCarImg(land.landId);
mCarTypeImg.OnSetLandPlant(land);
CarType(land.status);
Debug.Log("地块状态"+land.status);
setTime(land);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment