private CharacterData m_CharacterData; private CharacterSkillPart m_SkillPart; private AttackModeItem m_CurAttackModeItem; //当前选中修行方式item private int m_ClickSkillItemIndex; //点击选中的技能预制体的索引 private List<ItemSubSelectSkill> m_ItemsSelectSkill = new List<ItemSubSelectSkill>(); //选择技能预制体 private List<SkillFightFunctionEvaluationItem> m_SkillFunctionEvaluationScoreItems = new List<SkillFightFunctionEvaluationItem>(); //技能功能类型评分item集合 private const string StrongerKey = "FormUnitDetail.SubUICultivation.Stronger"; //有擅长 private const string WeaknessKey = "FormUnitDetail.SubUICultivation.Weakness"; //有较弱 private const string BalanceKey = "FormUnitDetail.SubUICultivation.Balance"; //均衡 protected void OnEnable() { GameEntry.Event.Subscribe(EventSelectedSkillAppoint.EventId, OnEventSelectedSkillAppoint); } protected void OnDisable() { if (GameEntry.Event.Check(EventSelectedSkillAppoint.EventId, OnEventSelectedSkillAppoint)) { GameEntry.Event.Unsubscribe(EventSelectedSkillAppoint.EventId, OnEventSelectedSkillAppoint); } } private void Awake() { m_SelectModeDropdown.onValueChanged.AddListener(CultivationSelectMode); InitFightSkill(); InitAttackMode(); InitSelectMode(); }

时间: 2024-02-10 19:26:41 浏览: 22
这段代码是一个类的成员变量和方法的定义。它包含了一些私有的成员变量,如CharacterData、CharacterSkillPart、AttackModeItem等。还有一些整型变量和集合类型的成员变量。 在OnEnable()方法中,订阅了一个名为EventSelectedSkillAppoint的事件。 在OnDisable()方法中,取消订阅了EventSelectedSkillAppoint事件,如果之前有订阅的话。 在Awake()方法中,给一个下拉列表m_SelectModeDropdown添加了一个事件监听器,并调用了InitFightSkill()、InitAttackMode()和InitSelectMode()方法。 以上就是这段代码的主要内容。
相关问题

java base58编码_base58 编码、解码

Base58编码是一种用于数字和字母的编码方式,它主要用于比特币地址、IPFS哈希等。 Java中实现Base58编码的方法如下: ```java import java.math.BigInteger; import java.util.Arrays; public class Base58 { private static final char[] ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".toCharArray(); private static final int BASE_58 = ALPHABET.length; public static String encode(byte[] input) { if (input.length == 0) { return ""; } // Count leading zeros. int zeros = 0; while (zeros < input.length && input[zeros] == 0) { ++zeros; } // Convert base-256 digits to base-58 digits (plus conversion to ASCII characters) byte[] temp = Arrays.copyOf(input, input.length); // since we modify it in-place char[] encoded = new char[temp.length * 2]; // upper bound int outputStart = encoded.length; for (int inputStart = zeros; inputStart < temp.length; ) { encoded[--outputStart] = ALPHABET[divmod(temp, inputStart, 256, BASE_58)]; if (temp[inputStart] == 0) { ++inputStart; // optimization - skip leading zeros } } // Preserve exactly as many leading encoded zeros in output as there were leading zeros in input. while (outputStart < encoded.length && encoded[outputStart] == ALPHABET[0]) { ++outputStart; } while (--zeros >= 0) { encoded[--outputStart] = ALPHABET[0]; } // Return encoded string (including encoded leading zeros). return new String(encoded, outputStart, encoded.length - outputStart); } public static byte[] decode(String input) { if (input.length() == 0) { return new byte[0]; } // Convert the base58-encoded ASCII chars to a base58 byte sequence (base58 digits). byte[] input58 = new byte[input.length()]; for (int i = 0; i < input.length(); ++i) { char c = input.charAt(i); int digit58 = -1; if (c >= '1' && c <= '9') { digit58 = c - '1'; } else if (c >= 'A' && c <= 'H') { digit58 = c - 'A' + 9; } else if (c >= 'J' && c <= 'N') { digit58 = c - 'J' + 17; } else if (c >= 'P' && c <= 'Z') { digit58 = c - 'P' + 22; } else if (c >= 'a' && c <= 'k') { digit58 = c - 'a' + 33; } else if (c >= 'm' && c <= 'z') { digit58 = c - 'm' + 44; } else if (c == 'l' || c == 'i') { digit58 = 34; } else if (c == 'o' || c == '0') { digit58 = 0; } if (digit58 == -1) { throw new IllegalArgumentException("Illegal character " + c + " at position " + i); } input58[i] = (byte) digit58; } // Count leading zeros. int zeros = 0; while (zeros < input58.length && input58[zeros] == 0) { ++zeros; } // Convert base-58 digits to base-256 digits. byte[] temp = new byte[input.length()]; int outputStart = temp.length; for (int inputStart = zeros; inputStart < input58.length; ) { temp[--outputStart] = divmod(input58, inputStart, BASE_58, 256); if (input58[inputStart] == 0) { ++inputStart; // optimization - skip leading zeros } } // Ignore extra leading zeros that were added during the calculation. while (outputStart < temp.length && temp[outputStart] == 0) { ++outputStart; } // Return decoded data (including original number of leading zeros). return Arrays.copyOfRange(temp, outputStart - zeros, temp.length); } private static byte divmod(byte[] number, int firstDigit, int base, int divisor) { // this is just long division which accounts for the base of the input digits int remainder = 0; for (int i = firstDigit; i < number.length; i++) { int digit = (int) number[i] & 0xFF; int temp = remainder * base + digit; number[i] = (byte) (temp / divisor); remainder = temp % divisor; } return (byte) remainder; } } ``` 使用方法: ```java String input = "Hello, world!"; byte[] data = input.getBytes(); String encoded = Base58.encode(data); byte[] decoded = Base58.decode(encoded); String output = new String(decoded); System.out.println("Input: " + input); System.out.println("Encoded: " + encoded); System.out.println("Decoded: " + output); ``` 输出结果如下: ``` Input: Hello, world! Encoded: 2NEpo7TZRX1LZEdD3V7LzF5awNk6JZLTbbU Decoded: Hello, world! ``` Base58编码在比特币等加密货币中有广泛应用。

unity TMP_Text设置鼠标光标,不使用Tmp_inputfield

要在 Unity 中使用 TMP_Text 设置鼠标光标,需要实现以下步骤: 1. 为 TMP_Text 组件添加 EventTrigger 组件,该组件可以捕捉鼠标事件。 2. 在 EventTrigger 组件中添加 PointerEnter 和 PointerExit 事件,用于设置光标的可见性。 3. 在 PointerEnter 事件中设置光标可见,并且使用 TMP_Text 的 GetCursorPosition 方法获取鼠标当前位置的字符索引。 4. 在 PointerExit 事件中设置光标不可见。 5. 使用 Input.compositionCursorPos 属性将光标位置设置为获取的字符索引。 以下是示例代码: ```csharp using UnityEngine; using UnityEngine.EventSystems; using TMPro; public class TMP_TextCursor : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler { public TMP_Text text; private bool isHovering = false; public void OnPointerEnter(PointerEventData eventData) { isHovering = true; Cursor.visible = false; } public void OnPointerExit(PointerEventData eventData) { isHovering = false; Cursor.visible = true; } private void Update() { if (isHovering) { int characterIndex = text.GetCursorPosition(Input.mousePosition); Input.compositionCursorPos = text.GetCharacterRect(characterIndex).position; } } } ``` 在该示例代码中,需要将 TMP_Text 组件分配给“text”字段。在 PointerEnter 事件中,将光标设置为不可见,在 PointerExit 事件中将光标设置为可见。在 Update 方法中,如果鼠标正在悬停在 TMP_Text 上,则获取当前鼠标位置的字符索引,并将光标位置设置为字符索引对应的位置。

相关推荐

private final CharSequence getSmallTime() { Context context = getContext(); boolean is24 = DateFormat.is24HourFormat(context); LocaleData d = LocaleData.get(context.getResources().getConfiguration().locale); final char MAGIC1 = '\uEF00'; final char MAGIC2 = '\uEF01'; SimpleDateFormat sdf; String format = is24 ? d.timeFormat24 : d.timeFormat12; // Add seconds to the format string format += ":ss"; if (!format.equals(mClockFormatString)) { /* * Search for an unquoted "a" in the format string, so we can * add dummy characters around it to let us find it again after * formatting and change its size. */ if (AM_PM_STYLE != AM_PM_STYLE_NORMAL) { int a = -1; boolean quoted = false; for (int i = 0; i < format.length(); i++) { char c = format.charAt(i); if (c == ''') { quoted = !quoted; } if (!quoted && c == 'a') { a = i; break; } } if (a >= 0) { // Move a back so any whitespace before AM/PM is also in the alternate size. final int b = a; while (a > 0 && Character.isWhitespace(format.charAt(a-1))) { a--; } format = format.substring(0, a) + MAGIC1 + format.substring(a, b) + "a" + MAGIC2 + format.substring(b + 1); } } mClockFormat = sdf = new SimpleDateFormat(format); mClockFormatString = format; } else { sdf = mClockFormat; } String result = sdf.format(mCalendar.getTime()); if (AM_PM_STYLE != AM_PM_STYLE_NORMAL) { int magic1 = result.indexOf(MAGIC1); int magic2 = result.indexOf(MAGIC2); if (magic1 >= 0 && magic2 > magic1) { SpannableStringBuilder formatted = new SpannableStringBuilder(result); if (AM_PM_STYLE == AM_PM_STYLE_GONE) { formatted.delete(magic1, magic2+1); } else { if (AM_PM_STYLE == AM_PM_STYLE_SMALL) { CharacterStyle style = new RelativeSizeSpan(0.7f); formatted.setSpan(style, magic1, magic2, Spannable.SPAN_EXCLUSIVE_INCLUSIVE); } formatted.delete(magic2, magic2 + 1); formatted.delete(magic1, magic1 + 1); } return formatted; } } return result;}如何实时更新秒

import java.util.*; class HuffmanNode implements Comparable<HuffmanNode> { int frequency; char data; HuffmanNode left, right; public HuffmanNode(int frequency, char data) { this.frequency = frequency; this.data = data; } public boolean isLeaf() { return left == null && right == null; } @Override public int compareTo(HuffmanNode node) { return frequency - node.frequency; } } public class HuffmanCoding { public static void main(String[] args) { String text = "Hello, world!"; Map<Character, Integer> frequencyMap = buildFrequencyMap(text); HuffmanNode root = buildHuffmanTree(frequencyMap); Map<Character, String> huffmanCodes = buildHuffmanCodes(root); System.out.println("Original text: " + text); System.out.println("Huffman codes: " + huffmanCodes); System.out.println("Encoded text: " + encode(text, huffmanCodes)); System.out.println("Decoded text: " + decode(encode(text, huffmanCodes), root)); } private static Map<Character, Integer> buildFrequencyMap(String text) { Map<Character, Integer> frequencyMap = new HashMap<>(); for (char c : text.toCharArray()) { frequencyMap.put(c, frequencyMap.getOrDefault(c, 0) + 1); } return frequencyMap; } private static HuffmanNode buildHuffmanTree(Map<Character, Integer> frequencyMap) { PriorityQueue<HuffmanNode> priorityQueue = new PriorityQueue<>(); for (Map.Entry<Character, Integer> entry : frequencyMap.entrySet()) { priorityQueue.offer(new HuffmanNode(entry.getValue(), entry.getKey())); } while (priorityQueue.size() > 1) { HuffmanNode left = priorityQueue.poll(); HuffmanNode right = priorityQueue.poll(); HuffmanNode parent = new HuffmanNode(left.frequency + right.frequency, '-'); parent.left = left; parent.right = right; priorityQueue.offer(parent); } return priorityQueue.poll(); } private static Map<Character, String> buildHuffmanCodes(HuffmanNode root) { Map<Character, String> huffmanCodes = new HashMap<>(); buildHuffmanCodesHelper(root, "", huffmanCodes); return huffmanCodes; } private static void buildHuffmanCodesHelper(HuffmanNode node, String code, Map<Character, String> huffmanCodes) { if (node.isLeaf()) { huffmanCodes.put(node.data, code); return; } buildHuffmanCodesHelper(node.left, code + "0", huffmanCodes); buildHuffmanCodesHelper(node.right, code + "1", huffmanCodes); } private static String encode(String text, Map<Character, String> huffmanCodes) { StringBuilder encodedText = new StringBuilder(); for (char c : text.toCharArray()) { encodedText.append(huffmanCodes.get(c)); } return encodedText.toString(); } private static String decode(String encodedText, HuffmanNode root) { StringBuilder decodedText = new StringBuilder(); HuffmanNode current = root; for (char c : encodedText.toCharArray()) { 后面代码请补充完整

最新推荐

recommend-type

Java开发案例-springboot-66-自定义starter-源代码+文档.rar

Java开发案例-springboot-66-自定义starter-源代码+文档.rar Java开发案例-springboot-66-自定义starter-源代码+文档.rar Java开发案例-springboot-66-自定义starter-源代码+文档.rar Java开发案例-springboot-66-自定义starter-源代码+文档.rar Java开发案例-springboot-66-自定义starter-源代码+文档.rar Java开发案例-springboot-66-自定义starter-源代码+文档.rar
recommend-type

单家独院式别墅图纸D027-三层-12.80&10.50米-施工图.dwg

单家独院式别墅图纸D027-三层-12.80&10.50米-施工图.dwg
recommend-type

啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦

啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦
recommend-type

课程大作业基于Vue+PHP开发的简单问卷系统源码+使用说明.zip

【优质项目推荐】 1、项目代码均经过严格本地测试,运行OK,确保功能稳定后才上传平台。可放心下载并立即投入使用,若遇到任何使用问题,随时欢迎私信反馈与沟通,博主会第一时间回复。 2、项目适用于计算机相关专业(如计科、信息安全、数据科学、人工智能、通信、物联网、自动化、电子信息等)的在校学生、专业教师,或企业员工,小白入门等都适用。 3、该项目不仅具有很高的学习借鉴价值,对于初学者来说,也是入门进阶的绝佳选择;当然也可以直接用于 毕设、课设、期末大作业或项目初期立项演示等。 3、开放创新:如果您有一定基础,且热爱探索钻研,可以在此代码基础上二次开发,进行修改、扩展,创造出属于自己的独特应用。 欢迎下载使用优质资源!欢迎借鉴使用,并欢迎学习交流,共同探索编程的无穷魅力! 课程大作业基于Vue+PHP开发的简单问卷系统源码+使用说明.zip Project setup ``` npm install ``` ### Compiles and hot-reloads for development ``` npm run serve ``` ### Compiles and minifies for production ``` npm run build ``` ### Lints and fixes files ``` npm run lint ``` ### Customize configuration See [Configuration Reference](https://cli.vuejs.org/config/).
recommend-type

zigbee-cluster-library-specification

最新的zigbee-cluster-library-specification说明文档。
recommend-type

管理建模和仿真的文件

管理Boualem Benatallah引用此版本:布阿利姆·贝纳塔拉。管理建模和仿真。约瑟夫-傅立叶大学-格勒诺布尔第一大学,1996年。法语。NNT:电话:00345357HAL ID:电话:00345357https://theses.hal.science/tel-003453572008年12月9日提交HAL是一个多学科的开放存取档案馆,用于存放和传播科学研究论文,无论它们是否被公开。论文可以来自法国或国外的教学和研究机构,也可以来自公共或私人研究中心。L’archive ouverte pluridisciplinaire
recommend-type

MATLAB柱状图在信号处理中的应用:可视化信号特征和频谱分析

![matlab画柱状图](https://img-blog.csdnimg.cn/3f32348f1c9c4481a6f5931993732f97.png) # 1. MATLAB柱状图概述** MATLAB柱状图是一种图形化工具,用于可视化数据中不同类别或组的分布情况。它通过绘制垂直条形来表示每个类别或组中的数据值。柱状图在信号处理中广泛用于可视化信号特征和进行频谱分析。 柱状图的优点在于其简单易懂,能够直观地展示数据分布。在信号处理中,柱状图可以帮助工程师识别信号中的模式、趋势和异常情况,从而为信号分析和处理提供有价值的见解。 # 2. 柱状图在信号处理中的应用 柱状图在信号处理
recommend-type

HSV转为RGB的计算公式

HSV (Hue, Saturation, Value) 和 RGB (Red, Green, Blue) 是两种表示颜色的方式。下面是将 HSV 转换为 RGB 的计算公式: 1. 将 HSV 中的 S 和 V 值除以 100,得到范围在 0~1 之间的值。 2. 计算色相 H 在 RGB 中的值。如果 H 的范围在 0~60 或者 300~360 之间,则 R = V,G = (H/60)×V,B = 0。如果 H 的范围在 60~120 之间,则 R = ((120-H)/60)×V,G = V,B = 0。如果 H 的范围在 120~180 之间,则 R = 0,G = V,B =
recommend-type

JSBSim Reference Manual

JSBSim参考手册,其中包含JSBSim简介,JSBSim配置文件xml的编写语法,编程手册以及一些应用实例等。其中有部分内容还没有写完,估计有生之年很难看到完整版了,但是内容还是很有参考价值的。
recommend-type

"互动学习:行动中的多样性与论文攻读经历"

多样性她- 事实上SCI NCES你的时间表ECOLEDO C Tora SC和NCESPOUR l’Ingén学习互动,互动学习以行动为中心的强化学习学会互动,互动学习,以行动为中心的强化学习计算机科学博士论文于2021年9月28日在Villeneuve d'Asq公开支持马修·瑟林评审团主席法布里斯·勒菲弗尔阿维尼翁大学教授论文指导奥利维尔·皮耶昆谷歌研究教授:智囊团论文联合主任菲利普·普雷教授,大学。里尔/CRISTAL/因里亚报告员奥利维耶·西格德索邦大学报告员卢多维奇·德诺耶教授,Facebook /索邦大学审查员越南圣迈IMT Atlantic高级讲师邀请弗洛里安·斯特鲁布博士,Deepmind对于那些及时看到自己错误的人...3谢谢你首先,我要感谢我的两位博士生导师Olivier和Philippe。奥利维尔,"站在巨人的肩膀上"这句话对你来说完全有意义了。从科学上讲,你知道在这篇论文的(许多)错误中,你是我可以依