69 lines
1.8 KiB
C#
Raw Normal View History

任务:编写留言系统、替换和实装美术素材 1.编写留言系统 (1.当玩家无Catch的时候,记录长按Y的时间,若时间大于两秒,呼唤UI,触发相应事件 *.编写撰写留言板逻辑 (*.清空操作地图 (1.呼出留言板UI (2.当按下确认键,确认建立一个本地留言板,并初始化该本地留言板,恢复操作地图 (3.将留言板数据传向云端 *.编写留言板逻辑 (1.内含BoardInfo内的信息 (2.继承于可交互物体 (3.当交互,呼出留言板UI,显示内容、UID等信息 (4.当按下返回键,关闭UI *.编写拉取留言板系统 (1.加在开幕演出中,开幕时呼叫sql上的脚本,拉取若干条留言板 (2.在场景内创建留言板,并初始化信息 *.替换和实装美术素材,增加部分动画 1.增加村内上树动画 2.更新村场景,使得玩家可以走到村下 3.制作以撒闪电攻击动画 4.制作以撒冲撞攻击动画 5.制作以撒雕像碎裂动画 6.贴上对话框 7.制作以撒闪电攻击动画 8.制作村民和贵族的待机角色 9.制作特洛伊木马死亡动画 10.制作特洛伊木马的喷射动画 *优化和修复 1.修复佛教前置关掉怪陷阱有时不会触发的问题 2.重做渲染层,避免出现覆盖问题 3.修复玩家会卡在村里桥上的问题 4.解决了屎山代码的warming问题 5.删除了子弹时间,效果太差 建议: 1.给击中添加一些效果,目前还是打击感太弱 2.目前木马死后,灰尘不会消失 *.至此,留言系统全部完成 下班
2021-12-25 00:37:29 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.InputSystem;
/// <summary>
/// 板子组件
/// </summary>
public class Board : Interactive
{
/// <summary>
/// 留言板内容
/// </summary>
public string text;
/// <summary>
/// 留言板主人的uid
/// </summary>
public int uid;
/// <summary>
/// 留言板位置
/// </summary>
public Vector2 postion;
private GameObject UI;
private Text textUI;
private Text UIDUI;
private MyPlayer player;
Board(Vector2 postion, int uid, string text){
this.postion = postion;
this.uid = uid;
this.text = text;
}
void Start(){
Init();
}
void Update(){
if(CheckComfirm()){
UI.SetActive(false);
player.GetComponent<PlayerInput>().SwitchCurrentActionMap("Normal");
}
}
private void Init(){
UI = GameObject.Find("留言板相关").transform.GetChild(1).gameObject;
textUI = UI.GetComponent<RectTransform>().GetChild(0).GetChild(0).GetComponent<Text>();
UIDUI = UI.GetComponent<RectTransform>().GetChild(0).GetChild(1).GetComponent<Text>();
player = FindObjectOfType<MyPlayer>();
}
/// <summary>
/// 当玩家与留言板互动
/// </summary>
public override void OnCall(){
UI.SetActive(true);
textUI.text = text;
UIDUI.text = "UID:"+uid;
player.GetComponent<PlayerInput>().SwitchCurrentActionMap("NullMap");
}
private bool CheckComfirm(){
//如果按下此帧按下此二键中的一个
return (Gamepad.current!= null &&
Gamepad.current.buttonEast.wasPressedThisFrame) ||
Input.GetKeyDown(KeyCode.K);
}
}