CTT/Unity/Assets/HotfixView/Entity/TransPoint.cs

72 lines
1.9 KiB
C#
Raw Normal View History

2021-04-08 20:09:59 +08:00
using System;
using System.Collections;
using System.Collections.Generic;
using ET;
using UnityEngine;
namespace ET
{
public class TransPointAwakeSystem : AwakeSystem<TransPoint, int, int>
{
public override void Awake(TransPoint self, int a, int b)
{
self.Awake(a, b);
}
}
public class TransPointDestroySystem : DestroySystem<TransPoint>
{
public override void Destroy(TransPoint self)
{
self.Destroy();
}
}
public class TransPoint : Entity
{
private int CurrTargetSceneId;
private int CurrTargetMapLayer;
public void Awake(int sceneId, int maplayer)
{
CurrTargetSceneId = sceneId;
CurrTargetMapLayer = maplayer;
}
public async ETTask OnEnter(Scene zoneScene, Collider2D collider)
{
if (CurrTargetSceneId == 0)
{
Game.EventSystem.Publish(new ET.EventType.TransPointUI_Right_Open
{
zoneScene = zoneScene
}).Coroutine();
return;
}
else if (CurrTargetSceneId == 1)
{
Game.EventSystem.Publish(new ET.EventType.TransPointUI_Left_Open
{
zoneScene = zoneScene
}).Coroutine();
return;
}
M2C_RequestEnterMap m2C_RequestEnterMap = await zoneScene.GetComponent<SessionComponent>().Call<M2C_RequestEnterMap>(new C2M_RequestEnterMap() { MapId = CurrTargetSceneId * 100 + CurrTargetMapLayer });
2021-04-08 20:09:59 +08:00
if (!m2C_RequestEnterMap.Message.IsNullOrEmpty())
{
TipHelper.OpenUI(m2C_RequestEnterMap.Message);
}
}
public void Destroy()
{
CurrTargetSceneId = 0;
CurrTargetMapLayer = 0;
}
}
}