翻译了一下unity wiki上对于有限状态机的案例,等有空时在详细写一下。在场景中添加两个游戏物体,一个为玩家并修改其Tag为Player,另一个为NPC为其添加NPCControl脚本,并为其将玩家角色和路径添加上去。(该案例利用状态机简单的实现了一个NPC的简单AI---巡逻---看到玩家----追逐玩家----丢失玩家----巡逻)

效果:

状态机:

  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5.  
  6. /**
  7. A Finite State Machine System based on Chapter 3.1 of Game Programming Gems 1 by Eric Dybsand
  8.  
  9. Written by Roberto Cezar Bianchini, July 2010
  10.  
  11. How to use:
  12. 1. Place the labels for the transitions and the states of the Finite State System
  13. in the corresponding enums.
  14.  
  15. 2. Write new class(es) inheriting from FSMState and fill each one with pairs (transition-state).
  16. These pairs represent the state S2 the FSMSystem should be if while being on state S1, a
  17. transition T is fired and state S1 has a transition from it to S2. Remember this is a Deterministic(确定的) FSM.
  18. You can't have one transition leading to two different states.
  19.  
  20. Method Reason is used to determine which transition should be fired.
  21. You can write the code to fire transitions in another place, and leave this method empty if you
  22. feel it's more appropriate 合适 to your project.
  23.  
  24. Method Act has the code to perform the actions the NPC is supposed do if it's on this state.
  25. You can write the code for the actions in another place, and leave this method empty if you
  26. feel it's more appropriate to your project.
  27.  
  28. 3. Create an instance of FSMSystem class and add the states to it.
  29.  
  30. 4. Call Reason and Act (or whichever methods you have for firing transitions and making the NPCs
  31. behave in your game) from your Update or FixedUpdate methods.
  32.  
  33. Asynchronous transitions from Unity Engine, like OnTriggerEnter, SendMessage, can also be used,
  34. just call the Method PerformTransition from your FSMSystem instance with the correct Transition
  35. when the event occurs 重现.
  36.  
  37. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  38. INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
  39. AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  40. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  41. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  42. */
  43.  
  44. /// <summary>
  45. /// Place the labels for the Transitions in this enum.
  46. /// Don't change the first label, NullTransition as FSMSystem class uses it.
  47. /// 为过渡加入枚举标签
  48. /// 不要修改第一个标签,NullTransition会在FSMSytem类中使用
  49. /// </summary>
  50. public enum Transition
  51. {
  52. NullTransition = , // Use this transition to represent a non-existing transition in your system
  53. //用这个过度来代表你的系统中不存在的状态
  54. SawPlayer,//这里配合NPCControl添加两个NPC的过渡
  55. LostPlayer,
  56. }
  57.  
  58. /// <summary>
  59. /// Place the labels for the States in this enum.
  60. /// Don't change the first label, NullStateID as FSMSystem class uses it.
  61. /// 为状态加入枚举标签
  62. /// 不要修改第一个标签,NullStateID会在FSMSytem中使用
  63. /// </summary>
  64. public enum StateID
  65. {
  66. NullStateID = , // Use this ID to represent a non-existing State in your syste
  67. //使用这个ID来代表你系统中不存在的状态ID
  68. ChasingPlayer,//这里配合NPCControl添加两个状态
  69. FollowingPath,
  70.  
  71. }
  72.  
  73. /// <summary>
  74. /// This class represents the States in the Finite State System.
  75. /// Each state has a Dictionary with pairs (transition-state) showing
  76. /// which state the FSM should be if a transition is fired while this state
  77. /// is the current state.
  78. /// Method Reason is used to determine which transition should be fired .
  79. /// Method Act has the code to perform the actions the NPC is supposed do if it's on this state.
  80. /// 这个类代表状态在有限状态机系统中
  81. /// 每个状态都有一个由一对搭档(过渡-状态)组成的字典来表示当前状态下如果一个过渡被触发状态机会进入那个状态
  82. /// Reason方法被用来决定那个过渡会被触发
  83. /// Act方法来表现NPC出在当前状态的行为
  84. /// </summary>
  85. public abstract class FSMState
  86. {
  87. protected Dictionary<Transition, StateID> map = new Dictionary<Transition, StateID>();
  88. protected StateID stateID;
  89. public StateID ID { get { return stateID; } }
  90.  
  91. public void AddTransition(Transition trans, StateID id)
  92. {
  93. // Check if anyone of the args is invalid
  94. //验证每个参数是否合法
  95. if (trans == Transition.NullTransition)
  96. {
  97. Debug.LogError("FSMState ERROR: NullTransition is not allowed for a real transition");
  98. return;
  99. }
  100.  
  101. if (id == StateID.NullStateID)
  102. {
  103. Debug.LogError("FSMState ERROR: NullStateID is not allowed for a real ID");
  104. return;
  105. }
  106.  
  107. // Since this is a Deterministic FSM,
  108. // check if the current transition was already inside the map
  109. //要知道这是一个确定的有限状态机(每个状态后金对应一种状态,而不能产生分支)
  110. //检查当前的过渡是否已经在地图字典中了
  111. if (map.ContainsKey(trans))
  112. {
  113. Debug.LogError("FSMState ERROR: State " + stateID.ToString() + " already has transition " + trans.ToString() +
  114. "Impossible to assign to another state");
  115. return;
  116. }
  117.  
  118. map.Add(trans, id);
  119. }
  120.  
  121. /// <summary>
  122. /// This method deletes a pair transition-state from this state's map.
  123. /// If the transition was not inside the state's map, an ERROR message is printed.
  124. /// 这个方法用来在状态地图中删除transition-state对儿
  125. /// 如果过渡并不存在于状态地图中,那么将会打印出一个错误
  126. /// </summary>
  127. public void DeleteTransition(Transition trans)
  128. {
  129. // Check for NullTransition
  130. if (trans == Transition.NullTransition)
  131. {
  132. Debug.LogError("FSMState ERROR: NullTransition is not allowed");
  133. return;
  134. }
  135.  
  136. // Check if the pair is inside the map before deleting
  137. //再删除之前确认该键值对是否存在于状态地图中(键值对集合)
  138. if (map.ContainsKey(trans))
  139. {
  140. map.Remove(trans);
  141. return;
  142. }
  143. Debug.LogError("FSMState ERROR: Transition " + trans.ToString() + " passed to " + stateID.ToString() +
  144. " was not on the state's transition list");
  145. }
  146.  
  147. /// <summary>
  148. /// This method returns the new state the FSM should be if
  149. /// this state receives a transition and
  150. /// 该方法在该状态接收到一个过渡时返回状态机需要成为的新状态
  151. /// </summary>
  152. public StateID GetOutputState(Transition trans)
  153. {
  154. // Check if the map has this transition
  155. if (map.ContainsKey(trans))
  156. {
  157. return map[trans];
  158. }
  159. return StateID.NullStateID;
  160. }
  161.  
  162. /// <summary>
  163. /// This method is used to set up the State condition before entering it.
  164. /// It is called automatically by the FSMSystem class before assigning it
  165. /// to the current state.
  166. /// 这个方法用来设立进入状态前的条件
  167. /// 在状态机分配它到当前状态之前他会被自动调用
  168. /// </summary>
  169. public virtual void DoBeforeEntering() { }
  170.  
  171. /// <summary>
  172. /// This method is used to make anything necessary, as reseting variables
  173. /// before the FSMSystem changes to another one. It is called automatically
  174. /// by the FSMSystem before changing to a new state.
  175. /// 这个方法用来让一切都是必要的,例如在有限状态机变化的另一个时重置变量。
  176. /// 在状态机切换到新的状态之前它会被自动调用。
  177. /// </summary>
  178. public virtual void DoBeforeLeaving() { }
  179.  
  180. /// <summary>
  181. /// This method decides if the state should transition to another on its list
  182. /// 动机-->这个方法用来决定当前状态是否需要过渡到列表中的其他状态
  183. /// NPC is a reference to the object that is controlled by this class
  184. /// NPC是被该类约束下对象的一个引用
  185. /// </summary>
  186. public abstract void Reason(GameObject player, GameObject npc);
  187.  
  188. /// <summary>
  189. /// This method controls the behavior of the NPC in the game World.
  190. /// 表现-->该方法用来控制NPC在游戏世界中的行为
  191. /// Every action, movement or communication the NPC does should be placed here
  192. /// NPC的任何动作,移动或者交流都需要防止在这儿
  193. /// NPC is a reference to the object that is controlled by this class
  194. /// NPC是被该类约束下对象的一个引用
  195. /// </summary>
  196. public abstract void Act(GameObject player, GameObject npc);
  197.  
  198. } // class FSMState
  199.  
  200. /// <summary>
  201. /// FSMSystem class represents the Finite State Machine class.
  202. /// It has a List with the States the NPC has and methods to add,
  203. /// delete a state, and to change the current state the Machine is on.
  204. /// 该类便是有限状态机类
  205. /// 它持有者NPC的状态集合并且有添加,删除状态的方法,以及改变当前正在执行的状态
  206. /// </summary>
  207. public class FSMSystem
  208. {
  209. private List<FSMState> states;
  210.  
  211. // The only way one can change the state of the FSM is by performing a transition
  212. // Don't change the CurrentState directly
  213. //通过预装一个过渡的唯一方式来盖面状态机的状态
  214. //不要直接改变当前的状态
  215. private StateID currentStateID;
  216. public StateID CurrentStateID { get { return currentStateID; } }
  217. private FSMState currentState;
  218. public FSMState CurrentState { get { return currentState; } }
  219.  
  220. public FSMSystem()
  221. {
  222. states = new List<FSMState>();
  223. }
  224. /// <summary>
  225. /// This method places new states inside the FSM,
  226. /// or prints an ERROR message if the state was already inside the List.
  227. /// First state added is also the initial state.
  228. /// 这个方法为有限状态机置入新的状态
  229. /// 或者在该状态已经存在于列表中时打印错误信息
  230. /// 第一个添加的状态也是最初的状态!
  231. /// </summary>
  232. public void AddState(FSMState s)
  233. {
  234. // Check for Null reference before deleting
  235. //在添加前检测空引用
  236. if (s == null)
  237. {
  238. Debug.LogError("FSM ERROR: Null reference is not allowed");
  239. }
  240.  
  241. // First State inserted is also the Initial state,
  242. // the state the machine is in when the begins
  243. //被装在的第一个状态也是初始状态
  244. //这个状态便是状态机开始时的状态
  245. if (states.Count == )
  246. {
  247. states.Add(s);
  248. currentState = s;
  249. currentStateID = s.ID;
  250. return;
  251. }
  252.  
  253. // Add the state to the List if it's not inside it
  254. //如果该状态未被添加过,则加入集合
  255. foreach (FSMState state in states)
  256. {
  257. if (state.ID == s.ID)
  258. {
  259. Debug.LogError("FSM ERROR: Impossible to add state " + s.ID.ToString() +
  260. " because state has already been added");
  261. return;
  262. }
  263. }
  264. states.Add(s);
  265. }
  266.  
  267. /// <summary>
  268. /// This method delete a state from the FSM List if it exists,
  269. /// or prints an ERROR message if the state was not on the List.
  270. /// 该方法删除一个已存在以状态几个中的状态
  271. /// 在它不存在时打印错误信息
  272. /// </summary>
  273. public void DeleteState(StateID id)
  274. {
  275. // Check for NullState before deleting
  276. //在删除前检查其是否为空状态
  277. if (id == StateID.NullStateID)
  278. {
  279. Debug.LogError("FSM ERROR: NullStateID is not allowed for a real state");
  280. return;
  281. }
  282.  
  283. // Search the List and delete the state if it's inside it
  284. //遍历集合如果存在该状态则删除它
  285. foreach (FSMState state in states)
  286. {
  287. if (state.ID == id)
  288. {
  289. states.Remove(state);
  290. return;
  291. }
  292. }
  293. Debug.LogError("FSM ERROR: Impossible to delete state " + id.ToString() +
  294. ". It was not on the list of states");
  295. }
  296.  
  297. /// <summary>
  298. /// This method tries to change the state the FSM is in based on
  299. /// the current state and the transition passed. If current state
  300. /// doesn't have a target state for the transition passed,
  301. /// an ERROR message is printed.
  302. /// 该方法基于当前状态和过渡是否通过来尝试改变状态机的状态,当当前的状态没有目标状态用来过渡(叫通道应该更合适吧)时通过时则打印错误消息
  303. /// </summary>
  304. public void PerformTransition(Transition trans)
  305. {
  306. // Check for NullTransition before changing the current state
  307. //在改变当前状态前检测NullTransition
  308. if (trans == Transition.NullTransition)
  309. {
  310. Debug.LogError("FSM ERROR: NullTransition is not allowed for a real transition");
  311. return;
  312. }
  313.  
  314. // Check if the currentState has the transition passed as argument
  315. //在改变当前状态前检测当前状态是否可作为过渡的参数
  316.  
  317. StateID id = currentState.GetOutputState(trans);
  318. if (id == StateID.NullStateID)
  319. {
  320. Debug.LogError("FSM ERROR: State " + currentStateID.ToString() + " does not have a target state " +
  321. " for transition " + trans.ToString());
  322. return;
  323. }
  324.  
  325. // Update the currentStateID and currentState
  326. //更新当前的状态个和状态编号
  327. currentStateID = id;
  328. foreach (FSMState state in states)
  329. {
  330. if (state.ID == currentStateID)
  331. {
  332. // Do the post processing of the state before setting the new one
  333. //在状态变为新状态前执行后处理
  334. currentState.DoBeforeLeaving();
  335.  
  336. currentState = state;
  337.  
  338. // Reset the state to its desired condition before it can reason or act
  339. //在状态可以使用Reason(动机)或者Act(行为)之前为它的的决定条件重置它自己
  340. currentState.DoBeforeEntering();
  341. break;
  342. }
  343. }
  344.  
  345. } // PerformTransition()
  346.  
  347. } //class FSMSystem

NPCControl:

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using UnityEngine;
  5.  
  6. [RequireComponent(typeof(Rigidbody))]
  7. public class NPCControl : MonoBehaviour
  8. {
  9. public GameObject player;
  10. public Transform[] path;
  11. private FSMSystem fsm;
  12.  
  13. public void SetTransition(Transition t)
  14. {
  15. //该方法用来改变有限状态机的状体,有限状态机基于当前的状态和通过的过渡状态。
  16. //如果当前的状态没有用来通过的过度状态,则会抛出错误
  17. fsm.PerformTransition(t);
  18. }
  19.  
  20. public void Start()
  21. {
  22. MakeFSM();
  23. }
  24.  
  25. public void FixedUpdate()
  26. {
  27. fsm.CurrentState.Reason(player, gameObject);
  28. fsm.CurrentState.Act(player, gameObject);
  29. }
  30.  
  31. //NPC有两个状态分别是在路径中巡逻和追逐玩家
  32. //如果他在第一个状态并且SawPlayer 过度状态被出发了,它就转变到ChasePlayer状态
  33. //如果他在ChasePlayer状态并且LostPlayer状态被触发了,它就转变到FollowPath状态
  34.  
  35. private void MakeFSM()//建造状态机
  36. {
  37. FollowPathState follow = new FollowPathState(path);
  38. follow.AddTransition(Transition.SawPlayer, StateID.ChasingPlayer);
  39.  
  40. ChasePlayerState chase = new ChasePlayerState();
  41. chase.AddTransition(Transition.LostPlayer, StateID.FollowingPath);
  42.  
  43. fsm = new FSMSystem();
  44. fsm.AddState(follow);//添加状态到状态机,第一个添加的状态将作为初始状态
  45. fsm.AddState(chase);
  46. }
  47. }
  48.  
  49. public class FollowPathState : FSMState
  50. {
  51. private int currentWayPoint;
  52. private Transform[] waypoints;
  53.  
  54. //构造函数装填自己
  55. public FollowPathState(Transform[] wp)
  56. {
  57. waypoints = wp;
  58. currentWayPoint = ;
  59. stateID = StateID.FollowingPath;//别忘设置自己的StateID
  60. }
  61.  
  62. public override void DoBeforeEntering()
  63. {
  64. Debug.Log("FollowingPath BeforeEntering--------");
  65. }
  66.  
  67. public override void DoBeforeLeaving()
  68. {
  69. Debug.Log("FollowingPath BeforeLeaving---------");
  70. }
  71.  
  72. //重写动机方法
  73. public override void Reason(GameObject player, GameObject npc)
  74. {
  75. // If the Player passes less than 15 meters away in front of the NPC
  76. RaycastHit hit;
  77. if (Physics.Raycast(npc.transform.position, npc.transform.forward, out hit, 15F))
  78. {
  79. if (hit.transform.gameObject.tag == "Player")
  80. npc.GetComponent<NPCControl>().SetTransition(Transition.SawPlayer);
  81. }
  82. }
  83.  
  84. //重写表现方法
  85. public override void Act(GameObject player, GameObject npc)
  86. {
  87. // Follow the path of waypoints
  88. // Find the direction of the current way point
  89. Vector3 vel = npc.GetComponent<Rigidbody>().velocity;
  90. Vector3 moveDir = waypoints[currentWayPoint].position - npc.transform.position;
  91.  
  92. if (moveDir.magnitude < )
  93. {
  94. currentWayPoint++;
  95. if (currentWayPoint >= waypoints.Length)
  96. {
  97. currentWayPoint = ;
  98. }
  99. }
  100. else
  101. {
  102. vel = moveDir.normalized * ;
  103.  
  104. // Rotate towards the waypoint
  105. npc.transform.rotation = Quaternion.Slerp(npc.transform.rotation,
  106. Quaternion.LookRotation(moveDir),
  107. * Time.deltaTime);
  108. npc.transform.eulerAngles = new Vector3(, npc.transform.eulerAngles.y, );
  109.  
  110. }
  111.  
  112. // Apply the Velocity
  113. npc.GetComponent<Rigidbody>().velocity = vel;
  114. }
  115.  
  116. } // FollowPathState
  117.  
  118. public class ChasePlayerState : FSMState
  119. {
  120. //构造函数装填自己
  121. public ChasePlayerState()
  122. {
  123. stateID = StateID.ChasingPlayer;
  124. }
  125.  
  126. public override void DoBeforeEntering()
  127. {
  128. Debug.Log("ChasingPlayer BeforeEntering--------");
  129. }
  130.  
  131. public override void DoBeforeLeaving()
  132. {
  133. Debug.Log("ChasingPlayer BeforeLeaving---------");
  134. }
  135.  
  136. public override void Reason(GameObject player, GameObject npc)
  137. {
  138. // If the player has gone 30 meters away from the NPC, fire LostPlayer transition
  139. if (Vector3.Distance(npc.transform.position, player.transform.position) >= )
  140. npc.GetComponent<NPCControl>().SetTransition(Transition.LostPlayer);
  141. }
  142.  
  143. public override void Act(GameObject player, GameObject npc)
  144. {
  145. // Follow the path of waypoints
  146. // Find the direction of the player
  147. Vector3 vel = npc.GetComponent<Rigidbody>().velocity;
  148. Vector3 moveDir = player.transform.position - npc.transform.position;
  149.  
  150. // Rotate towards the waypoint
  151. npc.transform.rotation = Quaternion.Slerp(npc.transform.rotation,
  152. Quaternion.LookRotation(moveDir),
  153. * Time.deltaTime);
  154. npc.transform.eulerAngles = new Vector3(, npc.transform.eulerAngles.y, );
  155.  
  156. vel = moveDir.normalized * ;
  157.  
  158. // Apply the new Velocity
  159. npc.GetComponent<Rigidbody>().velocity = vel;
  160. }
  161.  
  162. } // ChasePlayerState

Unity最受欢迎的插件,可以让您的游戏如虎添翼,为您节省大量时间可以投入在游戏的创意和细节上

Unity FSM 有限状态机的更多相关文章

  1. Unity——FSM有限状态机

    FSM有限状态机 一.设计思路 1.共同的状态父类,提供可重写的进入,保持,退出该状态的生命周期方法: 2.状态机,管理所有状态(增删查改),状态机运行方法(Run): 3.在角色控制器中,实例化状态 ...

  2. Unity中FSM有限状态机

    什么是FSM FSM 即有限状态机,它是一个状态管理系统,表示一个对象的几种状态在指定条件下转移行为,即随着条件的不断改变内部状态不断地切换. FSM用处或者使用背景 通常使用FSM去实现一些简单的A ...

  3. FSM有限状态机

    1.什么是有限状态机 有限状态机(Finite State Machine),简称FSM,它由一组有限个状态.输入和根据输入及现有状态转换为下一个状态的转换函数组成,当然,通常每个状态机都必须有一个初 ...

  4. Unity 使用有限状态机 完美还原 王者荣耀 虚拟摇杆

    Unity 使用有限状态机 完美还原 王者荣耀 虚拟摇杆 效果如图所示 摇杆的UI组成 如图所示 简单的可以认为摇杆由1.2.3贴图组成 为摇杆的底座 为摇杆的杆 为摇杆的指向 可以理解这就是街机上的 ...

  5. FSM有限状态机 ---C#、Unity

    抽象类State public interface State//定义状态接口 { void Init();//初始化 int GetCurrentStateId();//返回当前状态Id void ...

  6. Unity中有限状态机的用法教程

    Unity开发VR之Vuforia 本文提供全流程,中文翻译. Chinar 坚持将简单的生活方式,带给世人!(拥有更好的阅读体验 -- 高分辨率用户请根据需求调整网页缩放比例) Chinar -- ...

  7. 使用 Unity 3D 开发游戏的架构设计难点

    Unity 3D 引擎对于开发者来说,入手非常快,因为它采用的是 C# 作为开发语言,这也大大降低了开发者的门槛.但凡只要懂一门编程语言的人都能使用 Unity 3D 引擎开发,另外 Unity 3D ...

  8. Lua中使用状态机FSM简单例子

    FSM 有限状态机: 一个有限状态机是一个设备,或者是一个设备模型,具有有限数量的状态,它可以在任何给定的时间根据输入进行操作,使得一个状态变换到另一个状态,或者是使一个输入或者一种行为的发生.一个有 ...

  9. 新FSM的一些思路

    好久之前写过一篇关于状态机的小例子,可以看这里http://www.cnblogs.com/mawanli/p/5966080.html,这篇博客首先感谢需要感谢当时看到凉鞋的笔记博客, 凉鞋的博客地 ...

随机推荐

  1. inux下使用自带mail发送邮件告警

    安装mailx工具,mailx是一个小型的邮件发送程序. 具体步骤如下: 1.安装 [root@localhost ~]# yum -y install mailx 2.编辑配置文件 [root@lo ...

  2. Java 获取指定包下的所有类

    package com.s.rest.util; import java.io.File; import java.io.FileFilter; import java.io.IOException; ...

  3. 算法学习记录-查找——平衡二叉树(AVL)

    排序二叉树对于我们寻找无序序列中的元素的效率有了大大的提高.查找的最差情况是树的高度.这里就有问题了,将无序数列转化为 二叉排序树的时候,树的结构是非常依赖无序序列的顺序,这样会出现极端的情况. [如 ...

  4. Python 学习笔记(十二)Python文件和迭代(二)

    迭代 基本含义 迭代是重复反馈过程的活动,其目的通常是为了接近并到达所需的目标或结果.每一次对过程的重复被称为一次“迭代”,而每一次迭代得到的结果会被用来作为下一次迭代的初始值.  在计算科学中,迭代 ...

  5. 嵌入式STM32开发环境之Keil5的安装(附资源)--

    全文copy,原文见https://blog.csdn.net/weixin_42602730/article/details/81007685 --------------------------- ...

  6. [USACO15DEC]最大流Max Flow(树链剖分,线段树)

    FJ给他的牛棚的N(2≤N≤50,000)个隔间之间安装了N-1根管道,隔间编号从1到N.所有隔间都被管道连通了. FJ有K(1≤K≤100,000)条运输牛奶的路线,第i条路线从隔间si运输到隔间t ...

  7. Delphi XE7调用Java Class,JAR

    Delphi XE5,XE6需要用户手工编译并将Classes.Dex加入到包中,不过Delphi XE7可以省掉这些工作了. 如何在XE7中调用Java,具体步骤如下: 1.将jar文件添加到XE7 ...

  8. python学习笔记(一)学习资料记录

    相关资料网站 1. python3简明教程 适合新学者,因为可以在线操作,并且校验结果,同时还有考试系统.比较基础 2. python数据分析数据科学中文英文工具书籍下载 免费的中英文数据的PDF下载 ...

  9. 【Spark】编程实战之模拟SparkRPC原理实现自定义RPC

    1. 什么是RPC RPC(Remote Procedure Call)远程过程调用.在Hadoop和Spark中都使用了PRC,它是一种通过网络从远程计算机程序上请求服务,而不需要了解底层网络技术的 ...

  10. 通过SSH服务登陆linux服务器(版本RHEL7)

    通过SSH服务登陆linux服务器(版本RHEL7) SSH服务概述:是一种能够以安全的方式提供远程登陆的协议,也是目前远程管理linux系统的首选方式.在此之前,我们一般使用FTP或者telnet来 ...