牧师与魔鬼——MVC程序设计游戏实现

2023-10-25 04:50

本文主要是介绍牧师与魔鬼——MVC程序设计游戏实现,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

游戏介绍

Priests and Devils

Priests and Devils is a puzzle game in which you will help the Priests and Devils to cross the river within the time limit. There are 3 priests and 3 devils at one side of the river. They all want to get to the other side of this river, but there is only one boat and this boat can only carry two persons each time. And there must be one person steering the boat from one side to the other side. In the flash game, you can click on them to move them and click the go button to move the boat to the other direction. If the priests are out numbered by the devils on either side of the river, they get killed and the game is over. You can try it in many > ways. Keep all priests alive! Good luck!

稍微总结一下:

目标:成功将3个牧师和3个魔鬼运到河对岸
限制条件:

  1. 船上最多载2人,且必须至少一人才能开船
  2. 河的一岸魔鬼人数多于牧师,且牧师数不为0,则游戏失败。

用户操作:点击相应的人物使其上下船,点击船即可移动到对岸。

游戏成果展示

视频展示:

  牧师与魔鬼小游戏unity实录_哔哩哔哩bilibili

项目获取:

魔鬼与牧师 https://www.aliyundrive.com/s/bYTRunqvV43

提取码: 3z2c 

游戏制作准备

1.分析游戏对象

1.牧师

2.魔鬼

3.船

4.河岸(两边都有)

2.玩家动作规则表

玩家动作规则表
玩家动作结果条件
点击人物角色(牧师/魔鬼)人物上船/下船游戏进行中且人物在岸上/船上
点击船船开动船上至少有一人且游戏未结束
点击Restart重新开始游戏

游戏结束且弹出Restart的按钮

点击return menu返回菜单
点击pause游戏暂停
点击game rules查看游戏规则
点击start game开始游戏处于Start Menu

3.对象预制

用方块建立河流、河岸等对象,调整其合适大小,并且记录其在摄像机范围内显示的坐标。用暗红色球体表示魔鬼,用白色立方体表示牧师,用长方块表示船。
大致完成好的场景如下图:

核心代码分析(MVC)

UML图

1.MVC介绍

1. 模型(Model):
   游戏中的模型代表游戏的数据和业务逻辑。它可以包括玩家、敌人、物品、关卡等游戏中的实体或对象。模型负责处理这些实体的状态、行为和规则,并提供一种访问和操作数据的接口。模型可以包括数据结构、算法、碰撞检测、游戏规则等。

2. 视图(View):
   游戏中的视图是玩家所看到的游戏界面。它可以包括游戏场景、用户界面、HUD(头上显示)等。视图负责将游戏中的数据和状态以可视化的方式呈现给玩家。视图可以根据模型的状态进行更新,并处理用户输入以进行交互。

3. 控制器(Controller):
   游戏中的控制器是处理用户输入和响应的组件。它接收来自玩家的输入,例如键盘、鼠标或手柄输入,并将其转化为游戏中的操作。控制器根据输入更新模型的状态,并根据模型的变化更新视图。它还可以处理游戏中的逻辑和规则,例如游戏流程、胜利条件、失败条件等。

2.Model

角色模型
/*角色模型*/public class RoleModel{GameObject role;           //角色对象int role_sign;             //角色类别标记,0为牧师,1为恶魔Click click;Move move;bool on_boat;              //是否在船上       LandModel land_model = (SSDirector.GetInstance().CurrentScenceController as Controllor).start_land;/*构造函数初始化*/public RoleModel(string role_name){if (role_name == "priest"){role = Object.Instantiate(Resources.Load("Perfabs/Priest", typeof(GameObject)), Vector3.zero, Quaternion.Euler(0, -8, 0)) as GameObject;role_sign = 0;}else{role = Object.Instantiate(Resources.Load("Perfabs/Devil", typeof(GameObject)), Vector3.zero, Quaternion.Euler(0, -8, 0)) as GameObject;role_sign = 1;}move = role.AddComponent(typeof(Move)) as Move;click = role.AddComponent(typeof(Click)) as Click;click.SetRole(this);}/*get,set函数*/public int GetSign() { return role_sign;}public LandModel GetLandModel(){return land_model;}public string GetName() { return role.name; }public bool IsOnBoat() { return on_boat; }public void SetName(string name) { role.name = name; }public void SetPosition(Vector3 pos) { role.transform.position = pos; }/*角色移动*/public void Move(Vector3 vec){move.MovePosition(vec);}public void MoveToLand(LandModel land){  role.transform.parent = null;land_model = land;on_boat = false;}public void MoveToBoat(BoatModel boat){role.transform.parent = boat.GetBoat().transform;land_model = null;          on_boat = true;}/*重置*/public void Reset(){land_model = (SSDirector.GetInstance().CurrentScenceController as Controllor).start_land;MoveToLand(land_model);SetPosition(land_model.GetEmpty());land_model.AddRoleOnLand(this);}}
船只模型
  public class BoatModel{GameObject boat;                                          Vector3[] start_vacancy;                //船在起点的空位Vector3[] end_vacancy;                  //船在终点的空位Move move;                                                    Click click;int boat_sign = 1;                      //船在起点还是终点,1为起点,-1为终点RoleModel[] roles = new RoleModel[2];   //在船上的角色/*构造函数,完成一些简单的初始化*/public BoatModel(){boat = Object.Instantiate(Resources.Load("Perfabs/Boat", typeof(GameObject)), new Vector3(4, -1.5F, 0), Quaternion.identity) as GameObject;//复制实例化对象,指定其位置并返回boat.name = "boat";move = boat.AddComponent(typeof(Move)) as Move;click = boat.AddComponent(typeof(Click)) as Click;click.SetBoat(this);start_vacancy = new Vector3[] { new Vector3(3.5F, -1, 0), new Vector3(4.5F, -1, 0) };end_vacancy = new Vector3[] { new Vector3(-4.5F, -1, 0), new Vector3(-3.5F, -1, 0) };}/*判断船是否是空的,空船不能移动*/public bool IsEmpty(){for (int i = 0; i < roles.Length; ++i){if (roles[i] != null)return false;}return true;}/*根据所在位置,确定移动方向*/public void BoatMove(){if (boat_sign == -1){move.MovePosition(new Vector3(4, -1.5F, 0));boat_sign = 1;}else{move.MovePosition(new Vector3(-4, -1.5F, 0));boat_sign = -1;}}/*放回当前位置的标志*/public int GetBoatSign(){ return boat_sign;}public RoleModel DeleteRoleByName(string role_name){for (int i = 0; i < roles.Length; ++i){if (roles[i] != null && roles[i].GetName() == role_name){RoleModel role = roles[i];roles[i] = null;return role;}}return null;}/*返回空位的角标*/public int GetEmptyIndex(){for (int i = 0; i < roles.Length; ++i){if (roles[i] == null){return i;}}return -1;}/*返回空位*/public Vector3 GetEmpty(){Vector3 pos;if(boat_sign == 1)pos = start_vacancy[GetEmptyIndex()];elsepos = end_vacancy[GetEmptyIndex()];return pos;}/*在船上添加角色*/public void AddRoleOnBoat(RoleModel role){roles[GetEmptyIndex()] = role;}/*返回船*/public GameObject GetBoat(){ return boat; }/*重置*/public void Reset(){if (boat_sign == -1)BoatMove();roles = new RoleModel[2];}/*得到船上角色的数量*/public int[] GetRoleNumber(){int[] count = { 0, 0 };for (int i = 0; i < roles.Length; ++i){if (roles[i] == null)continue;if (roles[i].GetSign() == 0)count[0]++;elsecount[1]++;}return count;}}
河岸模型
public class LandModel{GameObject land;                                //陆地对象Vector3[] positions;                            //角色放在陆地上的位置int land_type;                                  //陆地类型,-1为目的陆地标志,1为起点陆地标志RoleModel[] roles = new RoleModel[6];           //在陆地上的角色/*构造函数*/public LandModel(string land_type_string){//设置角色放在陆地上的位置positions = new Vector3[] {new Vector3(5.3F,-0.3F,0), new Vector3(6.1F,-0.3F,0), new Vector3(6.9F,-0.3F,0),new Vector3(7.7F,-0.3F,0), new Vector3(8.5F,-0.3F,0), new Vector3(9.3F,-0.3F,0)};if (land_type_string == "start"){//设置起点land = Object.Instantiate(Resources.Load("Perfabs/Stone", typeof(GameObject)), new Vector3(8, -1.5F, 0), Quaternion.identity) as GameObject;land_type = 1;}else if (land_type_string == "end"){//设置终点land = Object.Instantiate(Resources.Load("Perfabs/Stone", typeof(GameObject)), new Vector3(-8, -1.5F, 0), Quaternion.identity) as GameObject;land_type = -1;}}/*返回空位角标*/public int GetEmptyIndex(){for (int i = 0; i < roles.Length; ++i){if (roles[i] == null)return i;}return -1;          //没有则返回-1}/*成员变量LandType的get函数*/public int GetLandType() { return land_type; }/*返回空位*/public Vector3 GetEmpty(){Vector3 pos = positions[GetEmptyIndex()];pos.x = land_type * pos.x;          //利用两岸的x坐标对称return pos;}/*添加角色在该陆地上*/public void AddRoleOnLand(RoleModel role){roles[GetEmptyIndex()] = role;}/*删除该陆地上的指定角色*/public RoleModel DeleteRoleByName(string role_name) { for (int i = 0; i < roles.Length; ++i){if (roles[i] != null && roles[i].GetName() == role_name){RoleModel role = roles[i];roles[i] = null;return role;}}return null;}/*得到角色数量*/public int[] GetRoleNum(){int[] count = { 0, 0 };                    //count[0]是牧师数,count[1]是魔鬼数for (int i = 0; i < roles.Length; ++i){if (roles[i] != null){if (roles[i].GetSign() == 0)count[0]++;elsecount[1]++;}}return count;}/*重置*/public void Reset(){roles = new RoleModel[6];}}

3.View

游戏界面
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using Mygame;
public class UserGUI : MonoBehaviour {private IUserAction action;public int sign = 0;//=0表示游戏在进行,=1表示游戏失败,=2表示游戏胜利,=3表示游戏停止bool isShowRules = false;public string timeStr = string.Empty;void Start(){action = SSDirector.GetInstance().CurrentScenceController as IUserAction;}void OnGUI(){/*设置计时器*/timeStr = string.Format("用时:{0:D2}:{1:D2}:{2:D2}", action.getTimer().hour, action.getTimer().minute, action.getTimer().second);GUI.Label(new Rect(500, 10, 100, 200), timeStr);/*定义字体风格*/GUIStyle text_style;GUIStyle button_style;text_style = new GUIStyle(){fontSize = 30};button_style = new GUIStyle("button"){fontSize = 15};/*游戏规则按钮*/if (GUI.Button(new Rect(10, 10, 100, 30), "game rules", button_style)){/*点一下打开游戏规则提示,再点一下关闭游戏规则提示*/isShowRules = !isShowRules;}/*展示游戏规则*/if(isShowRules){GUI.Label(new Rect(Screen.width / 2 - 150, 50, 300, 50), "Win: all priests and demons cross the river");GUI.Label(new Rect(Screen.width / 2 - 150, 70, 400, 50), "Lose: there are more demons than priests on either side");GUI.Label(new Rect(Screen.width / 2 - 150, 90, 300, 50), "Tap priest, demon, ship to move");}/*返回菜单按钮*/if (GUI.Button(new Rect(120, 10, 100, 30), "return menu", button_style)) {SceneManager.LoadScene("startMenu", LoadSceneMode.Single);;//切换到"startMenu"界面并销毁本界面}/*重新开始按钮*/if (GUI.Button(new Rect(230, 10, 100, 30), "restart", button_style)) {sign = 0;action.Restart();}/*游戏暂停按钮*/if(GUI.Button(new Rect(340, 10, 100, 30), "pause", button_style)){if(sign==0){//游戏正在进行sign = 3;//游戏的状态发生改变action.getTimer().StopTiming();//事件暂停}}/*游戏暂停展示*/if(sign == 3){//游戏暂停,打印暂停并显示“Return Game”按钮提示玩家可以点击回到游戏中GUI.Label(new Rect(Screen.width / 2-100, Screen.height / 2-120, 100, 50), "Game pause!", text_style);if (GUI.Button(new Rect(Screen.width / 2 - 70, Screen.height / 2-40, 120, 50), "Return Game", button_style)){//回到游戏,游戏状态发生改变,时间开始计时sign = 0;action.getTimer().beginTiming();}}/*游戏结局展示*/if (sign == 1){//游戏失败,打印失败并显示“Try again”按钮提示玩家再进行尝试GUI.Label(new Rect(Screen.width / 2-90, Screen.height / 2-120, 100, 50), "Gameover!", text_style);if (GUI.Button(new Rect(Screen.width / 2 - 70, Screen.height / 2-40, 100, 50), "Try again", button_style)){sign = 0;action.Restart(); }}else if (sign == 2){//游戏成功,打印成狗并显示“Play again”按钮提示玩家再玩一局GUI.Label(new Rect(Screen.width / 2 - 80, Screen.height / 2 - 120, 100, 50), "You win!", text_style);if (GUI.Button(new Rect(Screen.width / 2 - 70, Screen.height / 2-40, 100, 50), "Play again", button_style)){sign = 0;action.Restart();}}}
}
主菜单界面
using UnityEngine;
using UnityEngine.SceneManagement;public class StartMenu : MonoBehaviour {public Texture2D img;//背景图片private void OnGUI() {/*定义数值参数*/float height = Screen.height * 0.5f;float width = Screen.width * 0.5f;int ButtonHeight = 50;int ButtonWidth = 150;int TitleHeight = 80;int TitleWidth = 200;/*定义字体风格*/GUIStyle tStyle1 = new GUIStyle {fontSize = 40,fontStyle = FontStyle.Bold,};GUIStyle tStyle2 = new GUIStyle {fontSize = 30,fontStyle = FontStyle.Bold,};/*设置背景图片*/GUIStyle BackgroundStyle = new GUIStyle();BackgroundStyle.normal.background = img;/*设置按钮字体风格*/GUIStyle ButtonStyle = new GUIStyle("button");ButtonStyle.fontSize = 20;/*放置标题*/GUI.Label(new Rect(0, 0, Screen.width, Screen.height), "", BackgroundStyle);GUI.Label(new Rect(width - TitleWidth / 2 - TitleWidth / 4, height - TitleHeight * 2, TitleWidth, TitleHeight), "Priests And Devils", tStyle1);GUI.Label(new Rect(width - ButtonWidth / 2, height - TitleHeight , TitleWidth, TitleHeight), "Start Menu", tStyle2);/*开始游戏按钮*/if (GUI.Button(new Rect(width - ButtonWidth / 2 , height + ButtonHeight / 4, ButtonWidth, ButtonHeight), "Start Game", ButtonStyle)) {SceneManager.LoadScene("game", LoadSceneMode.Single);//切换到"game"界面并销毁开始菜单界面}}
}

4.Controller

Director

首先是Director,它是游戏设计中最高层的管理者,采用了单例模式,也就是说游戏中只能有一个Director实例存在。这个比喻非常贴切,无论场景如何变化,都只有一个指挥者来指挥全局,否则就会变得混乱不堪。Director在游戏中扮演了这样的角色,名义上负责管理所有的事务,但实际上它主要负责管理底下的Controller,指挥它们完成各种不同的功能。

 /*导演类:掌控着场景的加载、切换等*/public class SSDirector : System.Object{private static SSDirector _instance;              //导演类的实例public ISceneController CurrentScenceController { get; set; }public static SSDirector GetInstance(){if (_instance == null){_instance = new SSDirector();}return _instance;}}
Controller

游戏中所有事物的总控制器,其中包含所有游戏所需要的逻辑代码,与控制代码。如创建对象,移动船,移动角色,判定游戏输赢等。


public class Controllor : MonoBehaviour, ISceneController, IUserAction{public LandModel start_land; //开始陆地public LandModel destination; //目标陆地public BoatModel boat; //船private RoleModel[] roles; //角色UserGUI game_GUI; //用户界面public Timer timer; //计时器void Start (){SSDirector.GetInstance().CurrentScenceController = this;//设置导演类的控制器game_GUI = gameObject.AddComponent<UserGUI>() as UserGUI;//挂载用户界面组件timer = gameObject.AddComponent(typeof(Timer)) as Timer;//挂载计时器组件LoadResources();//加载界面资源}/*定义该函数,便于用户界面获得计时器以及其中的时钟变量*/public Timer getTimer(){return timer;}/*创建资源,并将其定义在特定的位置*/public void LoadResources(){//创建水,陆地,角色,船GameObject water = Instantiate(Resources.Load("Perfabs/Water", typeof(GameObject)), new Vector3(0 , -2 , 0), Quaternion.identity) as GameObject;water.name = "water"; //创建陆地:两岸start_land = new LandModel("start");destination = new LandModel("end");//创建船boat = new BoatModel();//创建6个角色roles = new RoleModel[6];//创建3个牧师for (int i = 0; i < 3; ++i){RoleModel role = new RoleModel("priest");role.SetName("priest" + i);role.SetPosition(start_land.GetEmpty());role.MoveToLand(start_land);start_land.AddRoleOnLand(role);roles[i] = role;}//创建3个恶魔for (int i = 0; i < 3; ++i){RoleModel role = new RoleModel("devil");role.SetName("devil" + i);role.SetPosition(start_land.GetEmpty());role.MoveToLand(start_land);start_land.AddRoleOnLand(role);roles[i + 3] = role;}}/*移动船*/public void MoveBoat(){if (boat.IsEmpty() || game_GUI.sign != 0) return;//船为空或者游戏没有在进行的时候,船不能移动boat.BoatMove();game_GUI.sign=Check();//每一次移动触发一次检查}/*移动角色*/public void MoveRole(RoleModel role){if (game_GUI.sign != 0) return;//如果游戏没有在进行则角色不能移动if (role.IsOnBoat()){//当角色在船上时,点击回到船所靠的陆地LandModel land;if (boat.GetBoatSign() == -1)land = destination;elseland = start_land;boat.DeleteRoleByName(role.GetName());//删掉船上的该角色role.Move(land.GetEmpty());role.MoveToLand(land);land.AddRoleOnLand(role);//添加该角色到上岸陆地}else{                                LandModel land = role.GetLandModel();if (boat.GetEmptyIndex() == -1 || land.GetLandType() != boat.GetBoatSign()) return;   //船没有空位,也不是船停靠的陆地,就不上船land.DeleteRoleByName(role.GetName());role.Move(boat.GetEmpty());role.MoveToBoat(boat);boat.AddRoleOnBoat(role);}game_GUI.sign=Check();//每一次移动触发一次检查}/*重新开始游戏*/public void Restart(){timer.Reset();start_land.Reset();destination.Reset();boat.Reset();for (int i = 0; i < roles.Length; ++i){roles[i].Reset();}}/*检查游戏是否结束*/public int Check(){int start_priest = (start_land.GetRoleNum())[0];int start_devil = (start_land.GetRoleNum())[1];int end_priest = (destination.GetRoleNum())[0];int end_devil = (destination.GetRoleNum())[1];//终点有全部对象,游戏胜利if (end_priest + end_devil == 6){timer.StopTiming();return 2;} //统计岸的一边(包括船和陆地上)魔鬼和牧师各自的数量int[] boat_role_num = boat.GetRoleNumber();if (boat.GetBoatSign() == 1) {start_priest += boat_role_num[0];start_devil += boat_role_num[1];}else{end_priest += boat_role_num[0];end_devil += boat_role_num[1];}//起点存在牧师且魔鬼数量大于牧师,牧师被吃,游戏失败if (start_priest > 0 && start_priest < start_devil){      timer.StopTiming();return 1;}//终点存在牧师且魔鬼数量大于牧师,牧师被吃,游戏失败if (end_priest > 0 && end_priest < end_devil){timer.StopTiming();return 1;}return 0;}
}
脚本
计时器脚本
 /*计时器脚本*/public class Timer: MonoBehaviour{public int hour = 0;            //小时public int minute = 0;          //分钟public int second = 0;          //秒public float time = 0f;         //总时间public bool timeStop=false;     //控制时钟是否暂停void Start(){hour = 0;          //小时minute = 0;        //分钟second = 0;        //秒time = 0f;         //总时间timeStop = false;  //是否暂停计时}void Update(){//计时if(!timeStop){time += Time.deltaTime;if (time >= 1f){second++;time = 0f;}if (second >= 60){minute++;second = 0;}if (minute >= 60){hour++;minute = 0;}if (hour >= 99){hour = 0;}}}/*暂停计时*/public void StopTiming(){timeStop = true;}/*开始计时*/public void beginTiming(){timeStop = false;}/*重置时间*/public void Reset(){hour = 0;    //小时minute = 0;  //分钟second = 0;  //秒time = 0f;timeStop = false;}}
移动脚本
/*移动脚本*/public class Move : MonoBehaviour{float move_speed = 30;                   //移动速度int move_sign = 0;                       //0是不动,1移动Vector3 end_pos;                         //存储最终位置Vector3 middle_pos;                      //存储角色从船移动到陆地或者从陆地移动到船上的轨迹转折点的位置。 void Update(){if(move_sign!=0 ){//物体可以移动transform.position = Vector3.MoveTowards(transform.position, middle_pos, move_speed * Time.deltaTime);if( transform.position == end_pos) move_sign=0;//只有当物体到达终点时,物体才停止移动else if (transform.position == middle_pos && middle_pos != end_pos){//转折点不是终点,需要再次移动middle_pos=end_pos;}               }}public void MovePosition(Vector3 position){end_pos = position;middle_pos = position;if (position.y < transform.position.y){     //角色从陆地移动到船middle_pos = new Vector3(position.x, transform.position.y, position.z);}else{                                        //角色从船移动到陆地middle_pos = new Vector3(transform.position.x, position.y, position.z);}move_sign = 1;//设置物体移动}}
鼠标点击脚本
/*鼠标点击脚本*/public class Click : MonoBehaviour{IUserAction action;RoleModel role = null;BoatModel boat = null;public void SetRole(RoleModel role){this.role = role;}public void SetBoat(BoatModel boat){this.boat = boat;}void Start(){action = SSDirector.GetInstance().CurrentScenceController as IUserAction;}void OnMouseDown(){if (boat == null && role == null) return;//被点击的对象为空时返回if (boat != null){//点击的对象为船,触发船进行移动action.MoveBoat();}else if(role != null){//点击的角色为船,触发角色进行移动action.MoveRole(role);}}}}

这篇关于牧师与魔鬼——MVC程序设计游戏实现的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/280135

相关文章

MyBatis-Plus逻辑删除实现过程

《MyBatis-Plus逻辑删除实现过程》本文介绍了MyBatis-Plus如何实现逻辑删除功能,包括自动填充字段、配置与实现步骤、常见应用场景,并展示了如何使用remove方法进行逻辑删除,逻辑删... 目录1. 逻辑删除的必要性编程1.1 逻辑删除的定义1.2 逻辑删php除的优点1.3 适用场景2.

C#借助Spire.XLS for .NET实现在Excel中添加文档属性

《C#借助Spire.XLSfor.NET实现在Excel中添加文档属性》在日常的数据处理和项目管理中,Excel文档扮演着举足轻重的角色,本文将深入探讨如何在C#中借助强大的第三方库Spire.... 目录为什么需要程序化添加Excel文档属性使用Spire.XLS for .NET库实现文档属性管理Sp

Python+FFmpeg实现视频自动化处理的完整指南

《Python+FFmpeg实现视频自动化处理的完整指南》本文总结了一套在Python中使用subprocess.run调用FFmpeg进行视频自动化处理的解决方案,涵盖了跨平台硬件加速、中间素材处理... 目录一、 跨平台硬件加速:统一接口设计1. 核心映射逻辑2. python 实现代码二、 中间素材处

Java数组动态扩容的实现示例

《Java数组动态扩容的实现示例》本文主要介绍了Java数组动态扩容的实现示例,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧... 目录1 问题2 方法3 结语1 问题实现动态的给数组添加元素效果,实现对数组扩容,原始数组使用静态分配

Python实现快速扫描目标主机的开放端口和服务

《Python实现快速扫描目标主机的开放端口和服务》这篇文章主要为大家详细介绍了如何使用Python编写一个功能强大的端口扫描器脚本,实现快速扫描目标主机的开放端口和服务,感兴趣的小伙伴可以了解下... 目录功能介绍场景应用1. 网络安全审计2. 系统管理维护3. 网络故障排查4. 合规性检查报错处理1.

Python轻松实现Word到Markdown的转换

《Python轻松实现Word到Markdown的转换》在文档管理、内容发布等场景中,将Word转换为Markdown格式是常见需求,本文将介绍如何使用FreeSpire.DocforPython实现... 目录一、工具简介二、核心转换实现1. 基础单文件转换2. 批量转换Word文件三、工具特性分析优点局

Springboot3统一返回类设计全过程(从问题到实现)

《Springboot3统一返回类设计全过程(从问题到实现)》文章介绍了如何在SpringBoot3中设计一个统一返回类,以实现前后端接口返回格式的一致性,该类包含状态码、描述信息、业务数据和时间戳,... 目录Spring Boot 3 统一返回类设计:从问题到实现一、核心需求:统一返回类要解决什么问题?

Java使用Spire.Doc for Java实现Word自动化插入图片

《Java使用Spire.DocforJava实现Word自动化插入图片》在日常工作中,Word文档是不可或缺的工具,而图片作为信息传达的重要载体,其在文档中的插入与布局显得尤为关键,下面我们就来... 目录1. Spire.Doc for Java库介绍与安装2. 使用特定的环绕方式插入图片3. 在指定位

Java使用Spire.Barcode for Java实现条形码生成与识别

《Java使用Spire.BarcodeforJava实现条形码生成与识别》在现代商业和技术领域,条形码无处不在,本教程将引导您深入了解如何在您的Java项目中利用Spire.Barcodefor... 目录1. Spire.Barcode for Java 简介与环境配置2. 使用 Spire.Barco

Java利用Spire.Doc for Java实现在模板的基础上创建Word文档

《Java利用Spire.DocforJava实现在模板的基础上创建Word文档》在日常开发中,我们经常需要根据特定数据动态生成Word文档,本文将深入探讨如何利用强大的Java库Spire.Do... 目录1. Spire.Doc for Java 库介绍与安装特点与优势Maven 依赖配置2. 通过替换