老实说,我不知道这个函数是如何被调用的(我确信它是一个简单的东西),我也不知道如何有效地搜索它(当我用谷歌搜索它时我没有找到它).
我在Haxe中有一组字符串变量调用
public static var variable01:String;
public static var variable02:String;
public static var variable03:String;
public static function TextContent()
{
variable01 = new String("abc");
variable02 = new String("def");
variable03 = new String("ghi");
}
Run Code Online (Sandbox Code Playgroud)
还有一个显示变量中文本的函数
_message = variable01;
_Dialogue = new FlxText(60, 400, 100, _message);
Run Code Online (Sandbox Code Playgroud)
当用户点击屏幕时,我希望显示中的变量更改为下一个.有没有办法简单地改变变量的数量?我需要能够为另一个对话框更改变量的文本,因为那时会有另一组具有相同模式的变量(text01,text02,text03等...)
我在ubuntu中找到并尝试了不同的Haxe IDE,并且都有自己的问题和依赖,甚至有些人已经失去了支持.这导致IDE难以为编码或开发做好准备.
目前使用足够公平的HIDE:s并在一个命令中安装.
Linux系统有什么好的工作IDE吗?
[更新]
我似乎无法使其正常工作,但如果在 Haxe 中无法实现,我会感到惊讶。
我正在尝试将游戏中定义的几个 Enum 值传递给一个函数,以便它可以将它们连接为String
类型并将其传递给其他函数。
例子:
// In a general Entity class:
public override function kill():Void {
messages.dispatchCombined(entityType, ListMessages.KILLED);
super.kill();
}
Run Code Online (Sandbox Code Playgroud)
在我的 Messages.hx 类中:
package common;
import msignal.Signal.Signal1;
/**
* A Message / Event class using Signals bound to String names.
* @author Pierre Chamberlain
*/
class Messages{
var _messages:MessagesDef;
public function new() {
_messages = new MessagesDef();
}
public function add(pType:String, pCallback:FuncDef) {
if (_messages[pType] == null) {
_messages[pType] = new Signal1<Dynamic>();
}
var signals = …
Run Code Online (Sandbox Code Playgroud) 我知道Haxe 中有一个关于类属性的常量问题。我的问题是:是否可以在函数内部定义常量?喜欢:
function foo(){
const bar=7;
bar = 8; // should prevent compilation
}
Run Code Online (Sandbox Code Playgroud)
也许像 var 之类的var foo:ReadOnlyInt
东西?
与动态对象相比,haxe 中的地图似乎非常慢
我会避开他们。
所以使用这段代码:
var nd=()->{
//var op:Dynamic = {x:100,y:1000};
//op.z = 22;
var op = {x:100,y:1000,z:22}
//var op = ['x'=>100,'y'=>1000];
//op['z'] = 22;
var i;
for(i in 0...1000000)
{
/*
op['x']++;
op['y']--;
op['z']++;
*/
op.x++;
op.y--;
op.z++;
}
trace('Line');
}
var j;
var q:Float = haxe.Timer.stamp();
for(j in 0...100) nd();
trace(haxe.Timer.stamp()-q);
Run Code Online (Sandbox Code Playgroud)
地图慢得惊人
haxe ×5
string ×2
dictionary ×1
editor ×1
enums ×1
haxeflixel ×1
linux ×1
object ×1
openfl ×1
variables ×1