海淀天下城电子沙盘单机版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

64 lines
1.8 KiB

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class SecondNodeWindow : MonoBehaviour {
private SecondNodeObject nodeObject;
public InputField nodeName;
public InputField nodeDetail;
public Button okButton;
public Button cancelButton;
public string oldNodeName;
// Use this for initialization
void Start()
{
okButton.onClick.AddListener(OkFun);
cancelButton.onClick.AddListener(CancelFun);
}
// Update is called once per frame
void Update()
{
}
public void SetWindow(SecondNodeObject node)
{
nodeObject = node;
nodeName.text = nodeObject.nodeName;
nodeDetail.text = nodeObject.nodeDetail;
}
private void OkFun()
{
oldNodeName = nodeObject.nodeName;//先记录修改前的节点名字,为修改后对数据文件名称的修改做准备,因为数据文件是以节点名字命名的,囧。
nodeObject.nodeName = nodeName.text.Trim();
nodeObject.nodeDetail = nodeDetail.text.Trim();
if (nodeObject.nodeID == -1)
{
transform.parent.GetComponent<SecondNodeManager>().AddNode(nodeObject);
}
else
{
transform.parent.GetComponent<SecondNodeManager>().EditorNode(nodeObject);
}
}
private void CancelFun()
{
gameObject.SetActive(false);
if (nodeObject.nodeID == -1)
{
ResourceLoadWindow.Instance.LoadTipWindow("是否放弃此条记录?", DeleteRecord, ContinueRecord);
}
}
private void DeleteRecord()
{
transform.parent.GetComponent<SecondNodeManager>().DeleteRecord();
}
private void ContinueRecord()
{
transform.parent.GetComponent<SecondNodeManager>().ContinueRecord();
}
}