102 lines
2.1 KiB
C#
102 lines
2.1 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using BITFALL.InGameInternet;
|
|
using BITFALL.Items;
|
|
using BITFALL.Player;
|
|
using BITFALL.Player.Inventory;
|
|
using BITFALL.Trading;
|
|
using BITKit;
|
|
using BITKit.Entities.Player;
|
|
using NodeCanvas.Framework;
|
|
using UnityEngine;
|
|
using Object = UnityEngine.Object;
|
|
|
|
namespace BITFALL.Quest
|
|
{
|
|
public class PlayerOpenTrade : ActionTask<Object>
|
|
{
|
|
protected override void OnExecute()
|
|
{
|
|
base.OnExecute();
|
|
Data.Set(new PlayerTradeWithTrader()
|
|
{
|
|
Trader = agent.As<ITrader>()
|
|
});
|
|
EndAction();
|
|
}
|
|
}
|
|
public class PlayerOpenContainer : ActionTask<WorldItemContainer>
|
|
{
|
|
protected override void OnExecute()
|
|
{
|
|
base.OnExecute();
|
|
Data.Set(new PlayerSwapWithContainer()
|
|
{
|
|
Container = agent
|
|
});
|
|
EndAction();
|
|
}
|
|
}
|
|
public class CreateMeChatUser : ActionTask
|
|
{
|
|
public BBParameter<string> username;
|
|
protected override void OnExecute()
|
|
{
|
|
username.value = Guid.NewGuid().ToString();
|
|
EndAction();
|
|
}
|
|
}
|
|
public class TransferToPostman : ActionTask
|
|
{
|
|
public BBParameter<int> money;
|
|
protected override void OnExecute()
|
|
{
|
|
WorldTrader.GlobalCredit += money.value;
|
|
EndAction();
|
|
}
|
|
}
|
|
public class TransferToPlayer : ActionTask
|
|
{
|
|
public BBParameter<string> detail;
|
|
public BBParameter<int> money;
|
|
|
|
protected override void OnUpdate()
|
|
{
|
|
if (UnityPlayerServiceService.LocalPlayer.TryGetComponent<IPlayerInventory>(out var inventory))
|
|
{
|
|
inventory.Transfer(new MonetStrace()
|
|
{
|
|
Money = money.value,
|
|
Detail = detail.value,
|
|
});
|
|
}
|
|
EndAction();
|
|
}
|
|
}
|
|
public class WaitMeChatRevived : ActionTask
|
|
{
|
|
public BBParameter<string> receiver;
|
|
public BBParameter<string> message;
|
|
protected override void OnExecute()
|
|
{
|
|
MeChatService.OnMessageReceived += OnMessageReceived;
|
|
}
|
|
|
|
private void OnMessageReceived(string arg1, string arg2, string arg3)
|
|
{
|
|
if (receiver.isDefined)
|
|
{
|
|
if(string.Equals(arg2,receiver.value) is false) return;
|
|
}
|
|
if(string.Equals(message.value,arg3))EndAction();
|
|
}
|
|
|
|
protected override void OnStop()
|
|
{
|
|
MeChatService.OnMessageReceived -= OnMessageReceived;
|
|
}
|
|
}
|
|
}
|
|
|