UDN
Search public documentation:

GFxAScriptToKismetCH
English Translation
日本語訳
한국어

Interested in the Unreal Engine?
Visit the Unreal Technology site.

Looking for jobs and company info?
Check out the Epic games site.

Questions about support via UDN?
Contact the UDN Staff

UE3 主页 > 用户界面 & HUD > Scaleform GFx > 怎样将一个外部界面调用传输到kismet

怎样将一个外部接口调用传输到kismet


概述


Scalefrom能渲染到一个稍后能在世界中显示的贴图,可以从ActionScript(动作脚本)中直接调用Kismet是很有用的。

ActionScript 2.0 方法


您的Flash按钮将按如下设置:

ActionScript
on (press)
{
  import flash.external.ExternalInterface;
  ExternalInterface.call("MyUnrealScriptFunction");
}

您可以使一个EnternalInterface调用传递任何数量个您所需要的参数。(例如: ExternalInterface.call("MyFunction", "Matthew", 37, true)传输一个字符串值、一个整形变量和一个布尔值)。 在这个示例中,我们传输任何内容。 我们只会调用MyUnrealScriptFunction函数。

在您的虚幻脚本中,您会看到以下内容:

Unrealscript
class MyMoviePlayer extends GFxMoviePlayer;

//function to receive External Interface call
function MyUnrealScriptFunction()
{
  `log("###### ExternalInterface Call Received #####");
  TriggerRemoteKismetEvent('MyEvent');
}

//function to trigger a remote kismet event
function TriggerRemoteKismetEvent( name EventName )
{
  local array<SequenceObject> AllSeqEvents;
  local Sequence GameSeq;
  local int i;

  GameSeq = GetPC().WorldInfo.GetGameSequence();
  if (GameSeq != None)
  {
    // find any Level Reset events that exist
    GameSeq.FindSeqObjectsByClass(class'SeqEvent_RemoteEvent', true, AllSeqEvents);

    // activate them
    for (i = 0; i < AllSeqEvents.Length; i++)
    {
      if(SeqEvent_RemoteEvent(AllSeqEvents[i]).EventName == EventName)
      {
        SeqEvent_RemoteEvent(AllSeqEvents[i]).CheckActivate(GetPC().WorldInfo, None);
      }
    }
  }
}

在关卡中添加一个远程事件kimset节点,然后将它命名为MyEvent。

然后将这个事件连接到您想要它发生的地方。