72 lines
1.9 KiB
C#
72 lines
1.9 KiB
C#
|
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 SessionComponent.Instance.Call<M2C_RequestEnterMap>(new C2M_RequestEnterMap() { MapId = CurrTargetSceneId * 100 + CurrTargetMapLayer });
|
|||
|
if (!m2C_RequestEnterMap.Message.IsNullOrEmpty())
|
|||
|
{
|
|||
|
TipHelper.OpenUI(m2C_RequestEnterMap.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void Destroy()
|
|||
|
{
|
|||
|
CurrTargetSceneId = 0;
|
|||
|
CurrTargetMapLayer = 0;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|