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.
57 lines
1.8 KiB
57 lines
1.8 KiB
4 years ago
|
using AX.NetworkSystem;
|
||
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using System.IO;
|
||
|
using System.Xml;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.SceneManagement;
|
||
|
using UnityEngine.UI;
|
||
|
|
||
|
public class EditDisaster : MonoBehaviour
|
||
|
{
|
||
|
private Button editBtn;
|
||
|
private string oldName;
|
||
|
// Use this for initialization
|
||
|
void Start()
|
||
|
{
|
||
|
editBtn = GetComponent<Button>();
|
||
|
editBtn.onClick.AddListener(Edit);
|
||
|
}
|
||
|
private void Edit()
|
||
|
{
|
||
|
if (DisasterList.Instance.AnySelected() == false)
|
||
|
{
|
||
|
ResourceLoadWindow.Instance.LoadTextHintWindow("请选择灾情", 2);
|
||
|
return;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
oldName = UpdateManager.Instance.selectedMsg.Name;
|
||
|
ResourceLoadWindow.Instance.LoadInputWindow("请编辑灾情名称", ConfirmNewName, null, UpdateManager.Instance.selectedMsg.Name);
|
||
|
}
|
||
|
}
|
||
|
private void ConfirmNewName(string disasterName)
|
||
|
{
|
||
|
//单机版注释下边ifelse
|
||
|
//if (oldName == disasterName) //名字没改
|
||
|
//{
|
||
|
// //先与服务端比对更新
|
||
|
// UpdateManager.Instance.Edit();
|
||
|
//}
|
||
|
//else //名字已改
|
||
|
//{
|
||
|
// UpdateManager.Instance.selectedMsg.Name = disasterName;
|
||
|
// NetworkManager.Default.SendAsync("UPDATE_DISASTER_INFO_REQUEST", UpdateManager.Instance.selectedMsg);
|
||
|
//}
|
||
|
//非单机版解开注释
|
||
|
if (oldName != disasterName)
|
||
|
{
|
||
|
UpdateManager.Instance.selectedMsg.Name = disasterName;
|
||
|
DisasterInfosManager.Instance.UpdateDisasterInfo(UpdateManager.Instance.selectedMsg.Id, UpdateManager.Instance.selectedMsg.Name);
|
||
|
}
|
||
|
UpdateManager.Instance.Edit();
|
||
|
oldName = "";
|
||
|
}
|
||
|
}
|