当前位置: 首页 > news >正文

html5网站用什么软件成都百度推广代理公司

html5网站用什么软件,成都百度推广代理公司,宿州网站建设时间,呼伦贝尔市建设网站目录 此篇需要你有一定的阅读代码的能力,不然点开了也不知道在做什么 这是读表工具 So文件这么写 使用 此篇需要你有一定的阅读代码的能力,不然点开了也不知道在做什么 在此之前你需要知道epplus是干什么的,然后知道其基本api&#xff0…

目录

        此篇需要你有一定的阅读代码的能力,不然点开了也不知道在做什么 

这是读表工具 

So文件这么写

 使用


        此篇需要你有一定的阅读代码的能力,不然点开了也不知道在做什么 

        在此之前你需要知道epplus是干什么的,然后知道其基本api,其实我之前写过一篇关于这个插件的说明

        【插件】【干货】用EPPlus在Unity中读写Excel表_epplus unity-CSDN博客

读表工具 

                 十分简单,然后又写了一个存入so文件类,涉及到一个所谓脏标记的api,箭头读取该excel表必不可少的重要的信息

using System.Collections.Generic;
using System.IO;
using UnityEngine;
using OfficeOpenXml;
using UnityEditor;public class ExcelTool {// 定义颜色单词与Color的映射字典private static Dictionary<string, Color> colorDictionary = new Dictionary<string, Color>(){{"green", new Color(0, 1, 0)},{"red", new Color(1, 0, 0)},{"gray", new Color(0.5f, 0.5f, 0.5f)},{"yellow", new Color(1, 1, 0)},{"clear", new Color(0.5f, 0.5f, 0.5f, 0.2f)}};// 从 Excel 导入史莱姆类型表public static SlimeTable ImportSlimeTypeTable(string filePath = "Assets/Resources/Model/史莱姆表.xlsx") {SlimeTable slimeTypeTable = ScriptableObject.CreateInstance<SlimeTable>();using (ExcelPackage excelPackage = new ExcelPackage(new FileInfo(filePath))) {ExcelWorksheet worksheet = excelPackage.Workbook.Worksheets[1];int rowCount = worksheet.Dimension.Rows;for (int i = 2; i <= rowCount; i++) {SlimeTypeData data = new SlimeTypeData();int.TryParse(worksheet.Cells[i, 1].Value?.ToString(), out data.ID);data.ID = i;if (System.Enum.TryParse(worksheet.Cells[i, 2].Value?.ToString(), out E_SlimeType slimeType)) {data.E_SlimeTypeData = slimeType;}if (System.Enum.TryParse(worksheet.Cells[i, 3].Value?.ToString(), out E_Recip recip)) {data.E_RecipData = recip;}string colorString = worksheet.Cells[i, 4].Value?.ToString();if (!string.IsNullOrEmpty(colorString)) {colorString = colorString.ToLower(); // 转换为小写,确保与字典中的键匹配if (colorDictionary.TryGetValue(colorString, out Color color)) {data.colorData = color;}else {Debug.LogError($"Failed to find color mapping for: {colorString} at row {i}");}}// 尝试将单元格的值解析为浮点数if (float.TryParse(worksheet.Cells[i, 5].Value?.ToString(), out float huangeyTime)) {data.huangeyTime = huangeyTime;}else {Debug.LogError($"Failed to parse huangeyTime at row {i}");}slimeTypeTable.dataList.Add(data);}}return slimeTypeTable;}
}public class ExcelImporterMenu {[MenuItem("Tools/Import Slime Table from Excel")]public static void ImportSlimeTableFromExcel() {SlimeTable slimeTypeTable = ExcelTool.ImportSlimeTypeTable();if (slimeTypeTable != null && slimeTypeTable.dataList.Count > 0) {// 假设当前选中的对象是一个 SlimeTable 实例SlimeTable selectedTable = Selection.activeObject as SlimeTable;if (selectedTable != null) {selectedTable.dataList = slimeTypeTable.dataList;EditorUtility.SetDirty(selectedTable);AssetDatabase.SaveAssets();Debug.Log("史莱姆表已成功从 Excel 导入");}else {Debug.LogWarning("请先在项目窗口中选中一个 SlimeTable 实例");}}else {Debug.LogError("导入史莱姆表时出现问题,请检查文件路径和文件内容");}}
}

So文件

using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;// 定义史莱姆类型数据结构[Serializable]public class SlimeTypeData {public int ID;public E_SlimeType E_SlimeTypeData;public E_Recip E_RecipData;public Color colorData;public float huangeyTime;}    // 定义史莱姆类型表的 ScriptableObject[CreateAssetMenu(fileName = "创建史莱姆列表")]public class SlimeTable : ScriptableObject {[SerializeField]public List<SlimeTypeData> dataList = new List<SlimeTypeData>();public Slime IndexForType(Slime slime,int index,Food f){ if(dataList.Count!=0) {SlimeTypeData data = dataList[index];slime.gameObject.name = data.E_SlimeTypeData.ToString();f.foodType = data.E_RecipData;slime.E_SlimeType = data.E_SlimeTypeData;slime.SpriteRd.color = data.colorData;slime.MaxHuangryValue = data.huangeyTime;slime.CurHuangryTimer = slime.MaxHuangryValue;}return slime;}
}

 使用

选择你创建出来的SO文件,然后点击你的菜单栏拓展 如果格式正确就能直接读取出来了

 

 

 

 

http://www.hrbkazy.com/news/24470.html

相关文章:

  • 两学一做网站专栏怎么设置郑州网站建设公司排名
  • 东莞市做网站厂房网络推广平台
  • wordpress image.php河南智能seo快速排名软件
  • 做报废厂房网站怎么做网站性能优化的方法有哪些
  • phpcms动态网站模板推广类软文
  • 金湖网站设计google 优化推广
  • 企业网站备案流程北京百度seo工作室
  • 网站建设官网免费模板怎么引流怎么推广自己的产品
  • 公司网站域名如何续费合肥网络关键词排名
  • 曲阳路街道网站建设怎么联系地推公司
  • wordpress导入tumblr网站如何做seo推广
  • 有没有免费的crm系统班级优化大师使用指南
  • 天动力网站开发企业网站推广方案策划
  • 自建商城网站有哪些平台seo关键词排名优化怎么样
  • 北京企业宣传片制作公司网页怎么优化
  • 户外运动网站模板企业域名查询
  • 做网站和做小程序有什么不同google手机官网
  • 网站建设是学哪个学科一站式网站设计
  • 西安做网站建设资源搜索引擎
  • 网站更新1688网站
  • 婚恋网站开发背景免费浏览网站推广
  • 适合小型工作室做的项目深圳网站设计十年乐云seo
  • 无锡网站关键词推广网址导航浏览器下载
  • 购买网站建设合同协议模板好搜seo软件
  • 小吃培训网站源码产品seo是什么意思
  • 网站开发页面适应高度最近一周的国内新闻
  • 阿里巴巴 网站建设深圳网站设计小程序
  • perl 网站开发seo推广专员工作内容
  • 网站做视频在线观看网址国产长尾关键词拘挖掘
  • 专门做外贸网站有哪些免费有效的推广平台