From ea185afc20a915d15eae8adb07d0acd837f3c210 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期一, 01 十二月 2025 11:37:29 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts
---
Main/System/Guild/GuildBaseWin.cs | 90 ++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 88 insertions(+), 2 deletions(-)
diff --git a/Main/System/Guild/GuildBaseWin.cs b/Main/System/Guild/GuildBaseWin.cs
index f75ce64..8584a57 100644
--- a/Main/System/Guild/GuildBaseWin.cs
+++ b/Main/System/Guild/GuildBaseWin.cs
@@ -1,5 +1,7 @@
using System.Collections;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
+using DG.Tweening;
using UnityEngine;
using UnityEngine.UI;
@@ -21,6 +23,19 @@
[SerializeField] Button requestBtn;
+
+ //NPC瀵硅瘽鐩稿叧
+ [Header("琛屽晢蹇呴』鏀剧涓�涓�")]
+ [SerializeField] HeroSkinModel[] funcNPCs;
+ [SerializeField] Transform[] talkRects;
+ [SerializeField] Text[] talkTexts;
+
+ //琛屽晢鐗规畩澶勭悊
+ [SerializeField] Transform hawkerRect;
+ [SerializeField] Transform pos1;
+ [SerializeField] Transform pos2;
+ [SerializeField] UIHeroController hawkerModel;
+
protected override void InitComponent()
{
guildBtn.AddListener(() =>
@@ -39,6 +54,7 @@
StoreModel.Instance.selectStoreFuncType = StoreFunc.Guild;
UIManager.Instance.OpenWindow<StoreBaseWin>();
});
+ InitHawker();
}
@@ -47,6 +63,7 @@
if (PlayerDatas.Instance.fairyData.fairy == null)
return;
GlobalTimeEvent.Instance.secondEvent += OnSecondEvent;
+ GlobalTimeEvent.Instance.fiveSecondEvent += OnFiveSecondEvent;
Display();
}
@@ -54,6 +71,7 @@
protected override void OnPreClose()
{
GlobalTimeEvent.Instance.secondEvent -= OnSecondEvent;
+ GlobalTimeEvent.Instance.fiveSecondEvent -= OnFiveSecondEvent;
}
@@ -65,7 +83,7 @@
void OnSecondEvent()
{
- ShowHawkerTime();
+ ShowHawkerTime(true);
}
void ShowGuildInfo()
@@ -86,7 +104,7 @@
UIManager.Instance.OpenWindow<GuildHawkerWin>();
}
- void ShowHawkerTime()
+ void ShowHawkerTime(bool modelPlay = false)
{
var toTenSeconds = TimeUtility.GetToTheHourSeconds();
if (toTenSeconds > 0)
@@ -95,12 +113,80 @@
guildHawkerInfo.SetActive(true);
var addStr = new string('.', (int)Time.time % 4);
guildHawkerInfo.text = Language.Get("Guild_72") + addStr;
+ if (modelPlay)
+ HawkerMove(false);
}
else
{
guildHawkerTimeText.text = TimeUtility.SecondsToHMS((int)(TimeUtility.GetTodayEndTime() - TimeUtility.ServerNow).TotalSeconds);
guildHawkerInfo.SetActive(false);
+ if (modelPlay)
+ HawkerMove(true);
+ }
+
+
+ }
+
+ void InitHawker()
+ {
+ if (FuncNPCManager.Instance.isHawkerStandBy)
+ {
+ hawkerRect.localPosition = pos1.localPosition;
+ }
+ else
+ {
+ hawkerRect.localPosition = pos2.localPosition;
+ }
+ hawkerModel.PlayAnimation("idle", true);
+ }
+
+ //isShow true璧板嚭鏉�,false璧板嚭鍘�
+ void HawkerMove(bool isShow)
+ {
+ if (isShow == FuncNPCManager.Instance.isHawkerShowNow)
+ {
+ return;
+ }
+ FuncNPCManager.Instance.isHawkerShowNow = isShow;
+ hawkerModel.PlayAnimation("zoulu", true);
+ FuncNPCManager.Instance.isHawkerStandBy = false;
+ hawkerModel.transform.localScale = new Vector3(isShow ? hawkerModel.transform.localScale.x : -hawkerModel.transform.localScale.x, hawkerModel.transform.localScale.y, hawkerModel.transform.localScale.z);
+ hawkerRect.DOLocalMove(isShow ? pos1.localPosition : pos2.localPosition, 1f).onComplete = () =>
+ {
+ hawkerModel.PlayAnimation("idle", true);
+
+ FuncNPCManager.Instance.isHawkerStandBy = isShow;
+ };
+ }
+
+
+
+
+ //NPC瀵硅瘽鐩稿叧
+ void OnFiveSecondEvent()
+ {
+ var index = FuncNPCManager.Instance.GetRandomGuildNpcTalk();
+ if (index == -1)
+ {
+ return;
+ }
+ var talk = FuncNPCManager.Instance.GetGuildTalk(funcNPCs[index].heroSkinID);
+ if (talk != null)
+ {
+ talkTexts[index].text = Language.Get(talk);
+ talkRects[index].SetActive(true);
}
+ var npc = funcNPCs[index].GetModel();
+ npc.PlayAnimation("hanhua", true);
+ Talk(index).Forget();
+ }
+
+ async UniTask Talk(int index)
+ {
+ await UniTask.Delay(5000);
+ talkRects[index].SetActive(false);
+ var npc = funcNPCs[index].GetModel();
+ npc.PlayAnimation("idle", true);
}
}
\ No newline at end of file
--
Gitblit v1.8.0