/// <summary> /// 展示 /// </summary> /// <param name="itemData"></param> protected void UIForBuildingItem(BuildingInfoBean itemData, bool isCreate) { GUILayout.BeginHorizontal(); if (isCreate) { if (EditorUI.GUIButton("创建建筑", 150)) { GetBuildingData(itemData); serviceForBuildingInfo.UpdateData(itemData); } } else { if (EditorUI.GUIButton("加载建筑", 150)) { SetBuildingData(itemData); } if (EditorUI.GUIButton("更新建筑", 150)) { GetBuildingData(itemData); serviceForBuildingInfo.UpdateData(itemData); } } EditorUI.GUIText("id", 50); itemData.id = EditorUI.GUIEditorText(itemData.id, 100); EditorUI.GUIText("名称", 50); itemData.name_cn = EditorUI.GUIEditorText(itemData.name_cn, 100); itemData.name_en = EditorUI.GUIEditorText(itemData.name_en, 100); if (isCreate) { } else { if (EditorUI.GUIButton("删除建筑", 150)) { serviceForBuildingInfo.DeleteData(itemData.id); } } GUILayout.EndHorizontal(); }
/// <summary> /// 保存游戏数据 /// </summary> /// <param name="data"></param> public void SetBuildingInfoData(BuildingInfoBean data) { serviceBuildingInfo.UpdateData(data); }