Merge branch 'main' of http://shu.sheziwanglo.cn:3000/wulongxiao/_xiaofang
This commit is contained in:
commit
93501dd2b0
@ -36,7 +36,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 164, y: -14}
|
||||
m_AnchoredPosition: {x: 164, y: -26}
|
||||
m_SizeDelta: {x: 328, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3645880154395566473
|
||||
@ -108,6 +108,7 @@ GameObject:
|
||||
- component: {fileID: 3645880154619645284}
|
||||
- component: {fileID: 557942137187336893}
|
||||
- component: {fileID: 6218000086705861260}
|
||||
- component: {fileID: 6335157935193920567}
|
||||
m_Layer: 5
|
||||
m_Name: Task
|
||||
m_TagString: Untagged
|
||||
@ -131,9 +132,9 @@ RectTransform:
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 164, y: -25}
|
||||
m_AnchorMin: {x: 0.5, y: 1}
|
||||
m_AnchorMax: {x: 0.5, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 328, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3645880154619645285
|
||||
@ -205,7 +206,7 @@ MonoBehaviour:
|
||||
m_Right: 0
|
||||
m_Top: 0
|
||||
m_Bottom: 0
|
||||
m_ChildAlignment: 0
|
||||
m_ChildAlignment: 4
|
||||
m_Spacing: 0
|
||||
m_ChildForceExpandWidth: 1
|
||||
m_ChildForceExpandHeight: 1
|
||||
@ -214,3 +215,18 @@ MonoBehaviour:
|
||||
m_ChildScaleWidth: 0
|
||||
m_ChildScaleHeight: 0
|
||||
m_ReverseArrangement: 0
|
||||
--- !u!114 &6335157935193920567
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3645880154619645306}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 38588f1b7a4315d4fb6983d86e935d19, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
jr: {fileID: 0}
|
||||
id: 0
|
||||
tasktxt: {fileID: 3645880154395566472}
|
||||
|
41
xiaofang/Assets/Prefabs/HYLPrefabs/TaskItem.cs
Normal file
41
xiaofang/Assets/Prefabs/HYLPrefabs/TaskItem.cs
Normal file
@ -0,0 +1,41 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class TaskItem : MonoBehaviour
|
||||
{
|
||||
public JSONReader jr;
|
||||
|
||||
public int id;
|
||||
|
||||
public Text tasktxt;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SetInfo(int id,JSONReader js)
|
||||
{
|
||||
this.id = id;
|
||||
jr = js;
|
||||
UpdateTxt();
|
||||
}
|
||||
|
||||
void UpdateTxt()
|
||||
{
|
||||
|
||||
Language info = jr.GetTaskByID(id,jr.LanguageDictionary);
|
||||
|
||||
tasktxt.text = info.Text;
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
11
xiaofang/Assets/Prefabs/HYLPrefabs/TaskItem.cs.meta
Normal file
11
xiaofang/Assets/Prefabs/HYLPrefabs/TaskItem.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 38588f1b7a4315d4fb6983d86e935d19
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -418,11 +418,40 @@ public class test : MonoBehaviour
|
||||
//¹ã²¥
|
||||
case "hall.BroadcastMessage":
|
||||
UserJoinResponse userJoinResponse = ProtoBufffer.DeSerialize<UserJoinResponse>(bytes);
|
||||
Debug.Log("玩家昵称:" + userJoinResponse.NickName + ",房间:" + userJoinResponse.RoomId.ToString() + ",用户角色"+ userJoinResponse.RoleName);
|
||||
|
||||
|
||||
|
||||
Debug.Log(userJoinResponse.IncidentPosition);
|
||||
Debug.Log(userJoinResponse);
|
||||
|
||||
|
||||
if(userJoinResponse.MessageType == 1)//用户上线
|
||||
{
|
||||
Debug.Log("玩家:" + userJoinResponse.NickName + "上线");
|
||||
}
|
||||
if(userJoinResponse.MessageType == 2)//用户下线
|
||||
{
|
||||
Debug.Log("玩家:" + userJoinResponse.NickName + "下线");
|
||||
}
|
||||
if(userJoinResponse.MessageType == 3)//加入房间
|
||||
{
|
||||
Debug.Log("玩家" + userJoinResponse.NickName + "加入房间:" + userJoinResponse.RoomId.ToString() + ",用户角色" + userJoinResponse.RoleName);
|
||||
}
|
||||
if(userJoinResponse.MessageType == 4)//事故发生
|
||||
{
|
||||
|
||||
}
|
||||
if(userJoinResponse.MessageType == 5)//火势
|
||||
{
|
||||
|
||||
}
|
||||
if(userJoinResponse.MessageType == 6)//任务
|
||||
{
|
||||
TaskInfoResponse taskInfoResponse = userJoinResponse.TaskResponse;
|
||||
if (long.Parse(taskInfoResponse.ToUserId) == userJoinResponse.UserId)//当这个任务是这个玩家的时显示任务
|
||||
{
|
||||
TaskPanel.instance.SetInfo(int.Parse(taskInfoResponse.TaskId));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@ -469,7 +498,7 @@ public class test : MonoBehaviour
|
||||
Debug.Log("-----------task.TaskTrigger");
|
||||
TaskTrigger taskTrigger = ProtoBufffer.DeSerialize<TaskTrigger>(bytes);
|
||||
Debug.Log(taskTrigger);
|
||||
|
||||
|
||||
|
||||
break;
|
||||
//¸üÐÂÈÎÎñ
|
||||
|
@ -7,6 +7,8 @@ using DG.Tweening;
|
||||
|
||||
public class TaskPanel : Base
|
||||
{
|
||||
public static TaskPanel instance;
|
||||
|
||||
public List<int> taskId = new List<int>();
|
||||
|
||||
public Transform contentTrans;
|
||||
@ -24,10 +26,10 @@ public class TaskPanel : Base
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
instance = this;
|
||||
closeBtn.onClick.AddListener(CloseBtn);
|
||||
|
||||
InitTask();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -37,10 +39,19 @@ public class TaskPanel : Base
|
||||
{
|
||||
GameObject go = GameObject.Instantiate(taskPrefab, contentTrans);
|
||||
go.transform.name = "Task_" + i;
|
||||
TaskItem item = go.GetComponent<TaskItem>();
|
||||
item.SetInfo(taskId[i], JSONReader);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void SetInfo(int id)
|
||||
{
|
||||
taskId.Add(id);
|
||||
InitTask();
|
||||
}
|
||||
|
||||
|
||||
public void CloseBtn()
|
||||
{
|
||||
if (isOpen)//¹Ø±ÕÈÎÎñÃæ°å
|
||||
@ -64,6 +75,9 @@ public class TaskPanel : Base
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
if(Input.GetKeyDown(KeyCode.J))
|
||||
{
|
||||
SetInfo(11001);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6806,6 +6806,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
retbutton: {fileID: 0}
|
||||
ClosureObj: {fileID: 0}
|
||||
taskId:
|
||||
contentTrans: {fileID: 1889829591}
|
||||
taskPrefab: {fileID: 3645880154619645306, guid: 1a0185fc1549da647943a21145debe29, type: 3}
|
||||
JSONReader: {fileID: 1526740604}
|
||||
@ -9267,7 +9268,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Content: {fileID: 1889829591}
|
||||
m_Horizontal: 1
|
||||
m_Horizontal: 0
|
||||
m_Vertical: 1
|
||||
m_MovementType: 1
|
||||
m_Elasticity: 0.1
|
||||
@ -21078,6 +21079,7 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 1889829591}
|
||||
- component: {fileID: 1889829592}
|
||||
- component: {fileID: 1889829593}
|
||||
m_Layer: 5
|
||||
m_Name: Content
|
||||
m_TagString: Untagged
|
||||
@ -21120,17 +21122,31 @@ MonoBehaviour:
|
||||
m_Padding:
|
||||
m_Left: 0
|
||||
m_Right: 0
|
||||
m_Top: 0
|
||||
m_Top: 20
|
||||
m_Bottom: 0
|
||||
m_ChildAlignment: 1
|
||||
m_ChildAlignment: 4
|
||||
m_Spacing: 8
|
||||
m_ChildForceExpandWidth: 1
|
||||
m_ChildForceExpandHeight: 1
|
||||
m_ChildControlWidth: 0
|
||||
m_ChildControlWidth: 1
|
||||
m_ChildControlHeight: 0
|
||||
m_ChildScaleWidth: 0
|
||||
m_ChildScaleHeight: 0
|
||||
m_ReverseArrangement: 0
|
||||
--- !u!114 &1889829593
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1889829590}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_HorizontalFit: 0
|
||||
m_VerticalFit: 2
|
||||
--- !u!1 &1891011313
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -43,15 +43,16 @@ public class Fire : MonoBehaviour
|
||||
HurtPeople();
|
||||
|
||||
|
||||
if (us.currentItem.transform.name != "NoFire" || us.currentItem == null)
|
||||
if (us.currentItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
else if(us.currentItem.transform.name != "NoFire")
|
||||
{
|
||||
MieFire();
|
||||
return;
|
||||
}
|
||||
|
||||
MieFire();
|
||||
|
||||
}
|
||||
|
||||
public void HurtPeople()
|
||||
|
@ -206,7 +206,7 @@ public class JSONReader : MonoBehaviour
|
||||
if (info.Note == "任务")
|
||||
{
|
||||
Debug.Log($"Found Language: ID = {info.ID}, Text = {info.Text}, Note = {info.Note}");
|
||||
dic.Add(id, info);
|
||||
//dic.Add(id, info);
|
||||
return info; // 返回符合条件的 Language 数据
|
||||
}
|
||||
else
|
||||
|
@ -19,6 +19,9 @@ public class FireHydrant : MonoBehaviour
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
xfs.gameObject.SetActive(true);
|
||||
|
Loading…
Reference in New Issue
Block a user