|
|
|
|
using SpringGUI;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
//Author:ZCG
|
|
|
|
|
//CreatTime:12/15/2017
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ˮ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class UIPlanWaterCannon : BaseInstanceMono
|
|
|
|
|
{
|
|
|
|
|
private static UIPlanWaterCannon instance;
|
|
|
|
|
public static UIPlanWaterCannon Instance
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (instance == null)
|
|
|
|
|
{
|
|
|
|
|
Transform canvas = GameObject.Find("Canvas").transform;
|
|
|
|
|
GameObject panel = Instantiate(Resources.Load("Prefab/Tool/UIPlanWaterCannon") as GameObject, canvas);
|
|
|
|
|
instance = panel.GetComponent<UIPlanWaterCannon>();
|
|
|
|
|
instance.Init();
|
|
|
|
|
}
|
|
|
|
|
return instance;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private Slider Slider_SetWaterSpeed;//ˮ<EFBFBD>ٶ<EFBFBD>
|
|
|
|
|
private Slider Slider_SetPingPongSpeed;//ҡ<EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>
|
|
|
|
|
private Text Text_WaterSpeed;//ˮ<EFBFBD>ٶ<EFBFBD>
|
|
|
|
|
private Text Text_PingPongSpeed;//ҡ<EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>
|
|
|
|
|
|
|
|
|
|
public void Init()
|
|
|
|
|
{
|
|
|
|
|
Slider_SetWaterSpeed = transform.Find("Slider_SetWaterSpeed").GetComponent<Slider>();
|
|
|
|
|
Slider_SetPingPongSpeed = transform.Find("Slider_SetPingPongSpeed").GetComponent<Slider>();
|
|
|
|
|
Text_WaterSpeed = transform.Find("Text_WaterSpeed").GetComponent<Text>();
|
|
|
|
|
Text_PingPongSpeed = transform.Find("Text_PingPongSpeed").GetComponent<Text>();
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
public override void LoadObjData(GameObject chooseObject)
|
|
|
|
|
{
|
|
|
|
|
gameObject.SetActive(true);
|
|
|
|
|
ChooseObj = chooseObject;
|
|
|
|
|
//ҡ<EFBFBD><EFBFBD>
|
|
|
|
|
var type = ChooseObj.GetComponent<WaterCannon>();
|
|
|
|
|
Slider_SetPingPongSpeed.value = type.GetPingPongSpeed() * 10;
|
|
|
|
|
Text_PingPongSpeed.text = (type.GetPingPongSpeed() * 10).ToString();
|
|
|
|
|
//<EFBFBD><EFBFBD>ˮ
|
|
|
|
|
var particle = ChooseObj.transform.Find("Rotate/Head/WaterStraight/WaterStraightPos/WaterStraight").GetComponent<ParticleControlOfType>();
|
|
|
|
|
Slider_SetWaterSpeed.value = particle.GetScaleValue() * 10;
|
|
|
|
|
Text_WaterSpeed.text = (particle.GetScaleValue()*10).ToString();
|
|
|
|
|
}
|
|
|
|
|
public override void ResetData(GameObject dataObj)
|
|
|
|
|
{
|
|
|
|
|
dataObj.GetComponent<WaterCannon>().Revocation();
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD>ٶ<EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="value"></param>
|
|
|
|
|
public void SetWaterSpeed(float value)
|
|
|
|
|
{
|
|
|
|
|
ChooseObj.GetComponent<WaterCannon>().SetWaterSpeed(value/10f);
|
|
|
|
|
Text_WaterSpeed.text = value.ToString();
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҡ<EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="value"></param>
|
|
|
|
|
public void SetPingPongSpeed(float value)
|
|
|
|
|
{
|
|
|
|
|
ChooseObj.GetComponent<WaterCannon>().SetPingPongSpeed(value/10f);
|
|
|
|
|
Text_PingPongSpeed.text = value.ToString();
|
|
|
|
|
}
|
|
|
|
|
public void OpenPingPong()
|
|
|
|
|
{
|
|
|
|
|
ChooseObj.GetComponent<WaterCannon>().OpenPingPong();
|
|
|
|
|
}
|
|
|
|
|
public void PutOutFire()
|
|
|
|
|
{
|
|
|
|
|
if (ChooseObj.GetComponent<WaterReceiver>().hasSupplier)
|
|
|
|
|
{
|
|
|
|
|
ChooseObj.GetComponent<WaterCannon>().PutOutFire();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ResourceLoadWindow.Instance.LoadTextHintWindow("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮԴ", 2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ȷ<EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void Confirm()
|
|
|
|
|
{
|
|
|
|
|
gameObject.SetActive(false);
|
|
|
|
|
ChooseObj.GetComponent<WaterCannon>().Confirm();
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <EFBFBD>ر<EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void Cancel()
|
|
|
|
|
{
|
|
|
|
|
Revocation();
|
|
|
|
|
gameObject.SetActive(false);
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void Revocation()
|
|
|
|
|
{
|
|
|
|
|
ChooseObj.GetComponent<WaterCannon>().Revocation();
|
|
|
|
|
LoadObjData(ChooseObj);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void EditorRight()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|