apps - adkevinchang/paracraftapi GitHub Wiki

apps

apps->Aries->Creator

WorldCommon

世界通用函数类

"(gl)script/apps/Aries/Creator/WorldCommon.lua"
commonlib.gettable("MyCompany.Aries.Creator.WorldCommon")

公共方法

WorldCommon.SaveWorld()
保存世界,无论世界是否有修改

------------------------
WorldCommon.SavePreviewImageIfNot()
保存预览图片

------------------------
WorldCommon.SaveWorldTag()
保存世界信息到tag.xml文件

 

apps->Aries->Creator->Game

game_logic

游戏逻辑类

"(gl)script/apps/Aries/Creator/Game/game_logic.lua"
commonlib.gettable("MyCompany.Aries.Game.GameLogic")
继承 commonlib.gettable("System.Core.ToolBase")

公共方法

GameLogic.RunCommand(...)
运行命令

------------------------  
GameLogic.GetSkyEntity()
获得天空实体

-----------------------
GameLogic.GetBlockInRightHand()
返回玩家右手上的模块id

------------------------

GameLogic.GetWorldDirectory()
获得当前世界的目录

-------------------------
GameLogic.GetHomePosition()
获得玩家的出生点

-------------------------
GameLogic.SetHomePosition(x,y,z)
设置玩家的出生点

-------------------------
GameLogic.GetWorld()
获得当前的世界

-------------------------
GameLogic.GetPlayer()
获得当前的玩家

-------------------------
GameLogic.PlayAnimation(params)
让玩家执行特定的动作

-------------------------
GameLogic.TeleportPlayer(x, y, z)
将当前玩家传送到指定的坐标点
 

block_engine

模块引擎类

"(gl)script/apps/Aries/Creator/Game/block_engine.lua"
commonlib.gettable("MyCompany.Aries.Game.BlockEngine")

公共方法

BlockEngine:SetBlock(x,y,z,block_id, block_data, flag, entity_data)
搭建模块命令

参数
   x,y,z:number -- 模块坐标
   block_id:number -- 模块id
   
--------------------------------
BlockEngine:GetBlockId(x,y,z)
根据坐标获得模块的id

-----------------------------
BlockEngine:SetBlockData(x,y,z,block_data, flag)
设置给定坐标位置模块的数据(例如模块的颜色)

-----------------------------
BlockEngine:GetAllBlocksInfoInAABB(aabb)
获得给定区域所有模块的完整信息(坐标、id、数据)

------------------------------
BlockEngine:GetBlockFull(x,y,z)
获得给定坐标位置模块的完整信息
 

game_options

"(gl)script/apps/Aries/Creator/Game/game_options.lua"
commonlib.gettable("MyCompany.Aries.Game.GameLogic.options")

公共方法

options:SetLastSaveTime()
设置最后保存的时间

---------------------------
options:SetTorchColor(r,g,b)
设置光源的颜色

参数
   r,g,b -- [0,2]

----------------------------
options:SetCameraObjectDistance(value)
设置摄像头到对象的距离

参数
   value:number -- [1,20]
 

GameDesktop

(gl)script/apps/Aries/Creator/Game/GameDesktop.lua")
commonlib.gettable("MyCompany.Aries.Creator.Game.Desktop")

公共方法

Desktop.OnActivateDesktop(mode)
当游戏模式改变时,调用刷新所有的用户接口

apps->Aries->Creator->Game->API

UserProfile

用户资料类

"(gl)script/apps/Aries/Creator/Game/API/UserProfile.lua"
commonlib.gettable("MyCompany.Aries.Creator.Game.API.UserProfile")

公共方法

UserProfile:SaveToDB()
将数据保存到本地电脑上
 

apps->Aries->Creator->Game->World

AutoSaver

自动保存类

(gl)script/apps/Aries/Creator/Game/World/AutoSaver.lua")
commonlib.gettable("MyCompany.Aries.Creator.Game.AutoSaver")

公共方法

AutoSaver:SetInterval(intervalMins)
设置间隔时间自动保存

参数
   intervalMins -- 间隔时间

--------------------------------
AutoSaver:SetSaveMode()
设置为保存模式

-------------------------------
AutoSaver:SetTipMode()
设置为提示模式


WorldSim

模拟世界类

(gl)script/apps/Aries/Creator/Game/World/WorldSim.lua
commonlib.gettable("MyCompany.Aries.Game.WorldSim")

公共方法

WorldSim:SetTimeOfDayStd(time)
设置一天中当前的时间

参数
   time -- 0或nil为正午 -0.5为黎明 0.5为黄昏 1或-1为午夜

RemoteWorld

(gl)script/apps/Aries/Creator/Game/Login/RemoteWorld.lua")
commonlib.gettable("MyCompany.Aries.Creator.Game.Login.RemoteWorld")

公共方法

RemoteWorld.LoadFromHref(href, server)
从HTML的href属性标签获得世界

-------------------------
RemoteWorld.LoadFromLocalFile(filename, server, text, revision, icon, author, size)
从本地获得世界文件

World

(gl)script/apps/Aries/Creator/Game/World/World.lua")
commonlib.gettable("MyCompany.Aries.Game.World.World")

公共方法

World:GetSpawnPoint()
获得玩家的出生点

apps->Aries->Creator->Game->Common

Translation

语言转换类

"(gl)script/apps/Aries/Creator/Game/Common/Translation.lua"
commonlib.gettable("MyCompany.Aries.Game.Common.Translation")

公共方法

Translation.SetCustomLanguage(locale, bChangeLanguage)
设置语言

参数
   locale:string -- 将要设置的语言(为auto时为系统默认的,为nil时为config中的)
   bChangeLanguage:bool -- 为true时改变语言
使用方法
   Translation.SetCustomLanguage("zhCN", true);  --设置为中文
   Translation.SetCustomLanguage("enUS", true);  --设置为英文

 

HttpFiles

http文件类

(gl)script/apps/Aries/Creator/Game/Common/HttpFiles.lua")
commonlib.gettable("MyCompany.Aries.Game.Common.HttpFiles")

公共方法

HttpFiles.GetHttpFilePath(url, callbackFunc, bCache)
下载http文件


Files

文件类

(gl)script/apps/Aries/Creator/Game/Common/Files.lua")
commonlib.gettable("MyCompany.Aries.Game.Common.Files")

公共方法

Files.GetWorldFilePath(any_filename, search_folder, bCache)
获得文件名的路径

apps->Aries->Creator->Game->Tasks

TaskManager

任务管理类

"(gl)script/apps/Aries/Creator/Game/Tasks/TaskManager.lua"
commonlib.gettable("MyCompany.Aries.Game.TaskManager")

公共方法

TaskManager.AddTask(task)
添加任务到管理器中

参数
   task -- 所要添加的任务,当task.is_top_level为true时,所有其他低等级的任务将被暂停,若此时已经存在高等级任务,则此任务将失败。
   
 

apps->Aries->Creator->Game->Entity

Entity

实体类

"(gl)script/apps/Aries/Creator/Game/Entity/Entity.lua"
commonlib.gettable("MyCompany.Aries.Game.EntityManager.Entity"))
继承 commonlib.gettable("System.Core.ToolBase")

公共方法

Entity:SetControlledExternally(bEnable)
是否锁定实体

参数
   bEnable:bool
   
------------------------
Entity:SetVisible(bVisible)
设置实体是否可见

参数
   bVisible:bool

------------------------
Entity:GetInnerObject()
获得ParaObject
   
------------------------  
Entity:SetCheckCollision(bCheck)
设置碰撞

参数
   bCheck:bool

------------------------ 
Entity:GetBlockPos()
获得实体在积木世界的位置

-------------------------
Entity:GetPosition()
获得实体在真实世界的位置

------------------------
Entity:Resume()
唤醒实体

-------------------------
Entity:Pause()
暂停实体时间事件操作

--------------------------
Entity:AddVelocity(x,y,z)
增加速度

-------------------------
Entity:SetVelocity(x,y,z)
设置xyz轴上的速度

-------------------------
Entity:SetAnimation(filenames)
设置实体的动作

-------------------------
Entity:DistanceSqTo(x,y,z)
计算实体到指定位置的距离

----------------------------
Entity:TeleportToBlockPos(x,y,z)
传输到指定的坐标位置

--------------------------
Entity:ToggleFly(bFly)
设置实体为飞行模式

-----------------------------
Entity:SetDead()
销毁实体

-----------------------------
Entity:DisableInput(bDisabled)
设置实体不响应任何的命令和用户输入

---------------------------
Entity:SetTimeToNextEvent()
设置本地时间为下一次事件时间来触发下一次事件

----------------------------
Entity:GetTimeEvent()
获得实体时间事件列表

---------------------------
Entity:ClearTimeEvent()
清除所有的时间事件

----------------------------
Entity:SetTime(time)
设置实体的本地时间

----------------------------
Entity:Say(text, duration, bAbove3D)
在实体对象的头顶显示文字

参数
   duration -- 文字持续的时间
   
---------------------------
Entity:SetGravity(value)
设置实体的重力

----------------------------
Entity:SetSpeedScale(value)
设置速度摩擦力

----------------------------
Entity:SetFocus()
设置玩家被控制

---------------------------
Entity:SetScaling(v)
设置玩家的模型缩放

----------------------------

Entity:SetSurfaceDecay(surface_decay)
设置地表摩擦力

参数 
   surface_decay -- [0,1] 0为没有摩擦力,1为使目标停止,默认为0.5
  
 

EntityManager

存储清单基类

"(gl)script/apps/Aries/Creator/Game/Entity/EntityManager.lua"
commonlib.gettable("MyCompany.Aries.Game.EntityManager")

公共方法

EntityManager.GetLastTriggerEntity()
获得最后一次进行操作的实体

---------------------------
EntityManager.GetPlayer(name)
通过玩家名字获得玩家

--------------------------
EntityManager.AddObject(entity)
将实体的相关信息添加到实体管理器中

--------------------------
EntityManager.GetFocus()
获得当前控制的实体

--------------------------
EntityManager.SetFocus(entity)
设置实体被控制

---------------------------
EntityManager.GetBlockEntity(x, y, z)
获得指定坐标位置的实体

--------------------------
EntityManager.GetItemCount(item_id)
通过模块的id获得对应模块的数量

-------------------------
EntityManager.AddEntityCount(item_id, delta_count)
增加相应实体的数量

-------------------------
EntityManager.RemoveObject(entity)
将实体从管理器中销毁

-------------------------
EntityManager.HasEntityInBlock(bx, by, bz)
判断在给定的坐标位置是否有实体

-------------------------
EntityManager.GetEntitiesInBlock(bx, by, bz)
获得指定位置的所有实体

EntityPlayer

玩家实体类

(gl)script/apps/Aries/Creator/Game/Entity/EntityPlayer.lua")
commonlib.gettable("MyCompany.Aries.Game.EntityManager.EntityPlayer")

公共方法

Entity:SetBlockInRightHand(blockid_or_item_stack)
在玩家的右手添加模块

-----------------------------
Entity:SetSkin(skin, bIgnoreSetSkinId)
设置玩家的皮肤材质

apps->Aries->Creator->Game->Sound

BackgroundMusic

背景音乐类

"(gl)script/apps/Aries/Creator/Game/Sound/BackgroundMusic.lua"
commonlib.gettable("MyCompany.Aries.Game.Sound.BackgroundMusic")

公共方法

BackgroundMusic:Stop(filename)
暂停音乐

参数
   filename:string -- 为nil时暂停当前的音乐
   
------------------------  
BackgroundMusic:SetMusic(audio_src, bToggleIfSame)
设置音乐
 
--------------------------
BackgroundMusic:GetMusic(filename)
通过文件名获得音源

--------------------------
BackgroundMusic:Play(filename, bToggleIfSame)
播放音乐

参数
   filename -- 可以为http资源文件


apps->Aries->Creator->Game->GameRules

GameRules

游戏规则类

"(gl)script/apps/Aries/Creator/Game/GameRules/GameRules.lua"
commonlib.gettable("MyCompany.Aries.Game.GameRules")

公共方法

GameRules:AddRule(class_name, rule_name, rule_value)
添加规则到当前的规则集合中

参数
   class_name -- Player Global Block
   rule_value -- 通常为nil
   
-----------------------------------
GameRules:GetScriptFullPath(filename)
获得文件的完整路径

-----------------------------------
GameRules:LoadFromFile(filename)
从规则文件中加载规则


apps->Aries->Creator->Game->blocks

block_types

模块类型类

(gl)script/apps/Aries/Creator/Game/blocks/block_types.lua")
commonlib.gettable("MyCompany.Aries.Game.block_types")

公共方法

block_types.get(id)
通过模块的id获得模块

-------------------
block_types.GetItemClass(class_name)
通过类对象名获得物品类

block

模块类

(gl)script/apps/Aries/Creator/Game/blocks/block.lua")
commonlib.gettable("MyCompany.Aries.Game.block")

公共方法

block:SetSpeedReduction(value)
降低模块的速度

参数
   value -- [0,1]
   
------------------------------
block:ReplaceTexture(filename, texture_index)
将模块的材质替换成filename指向的材质

-----------------------------
block:GetTexture(texture_index)
获得当前模块对应的材质
   
-------------------------------
block:SetVisible(bVisible)
设置模块可见或不可见

apps->Aries->Creator->Game->items

ItemClient

item client类

(gl)script/apps/Aries/Creator/Game/Items/ItemClient.lua
commonlib.gettable("MyCompany.Aries.Game.Items.ItemClient")

公共方法

ItemClient.GetItem(block_id)
通过模块id获得item

Item

item实体类

(gl)script/apps/Aries/Creator/Game/Items/Item.lua")
commonlib.gettable("MyCompany.Aries.Game.Items.Item")

公共方法

Item:TryCreate(itemStack, entityPlayer, x,y,z, side, data, side_region)
在指定的位置创造item实体


ItemStack

(gl)script/apps/Aries/Creator/Game/Items/ItemStack.lua")
commonlib.gettable("MyCompany.Aries.Game.Items.ItemStack")

公共方法

ItemStack:GetTooltip()
获得物品标签

----------------------
ItemStack:SetTooltip(value)
设置物品标签

InventoryBase

存储清单基类

(gl)script/apps/Aries/Creator/Game/Items/InventoryBase.lua")
commonlib.gettable("MyCompany.Aries.Game.Items.InventoryBase")

公共方法

 InventoryBase:ClearItems(item_id, item_count, from_slot_id, to_slot_id)
 清理指定数量的指定物品
 
 参数
    item_id -- 要清理的物品id
    itme_count -- 要清理的物品数量
 
----------------------------------
InventoryBase:Clear(from_slot_id, to_slot_id)
清除所有的物品

--------------------------------------
InventoryBase:AddItemToInventory(item_stack, from_slot)
添加物品到清单中

--------------------------------------
InventoryBase:OnInventoryChanged(slot_index)
当清单的内容发生变化时调用

-------------------------------------
InventoryBase:GetItemInRightHand()
获得右手上的物品

------------------------------------
InventoryBase:GetItem(slot_index)
获得给定槽的物品

ItemColorBlock

可改变颜色的模块类

ItemColorBlock:PaintBlock(x,y,z, color)
改变指定坐标位置的模块颜色

apps->Aries->Creator->Game->Physics

DynamicObject

动态对象类

(gl)script/apps/Aries/Creator/Game/Physics/DynamicObject.lua")
commonlib.gettable("MyCompany.Aries.Game.PhysicsWorld.DynamicObject")

公共方法

DynamicObject:SetAirDecay(air_decay)
设置空气摩擦力

apps->Aries->Creator->Game->Materials

LocalTextures

本地材质类

(gl)script/apps/Aries/Creator/Game/Materials/LocalTextures.lua")
commonlib.gettable("MyCompany.Aries.Game.Materials.LocalTextures")

公共方法

LocalTextures:GetByFileName(filename)
通过文件名获得材质

apps->Aries->Creator->Game->Movie

MovieManager

电影管理类

(gl)script/apps/Aries/Creator/Game/Movie/MovieManager.lua
commonlib.gettable("MyCompany.Aries.Game.Movie.MovieManager")

公共方法

MovieManager:GetActiveMovieClip()
获得当前的影片剪辑

MovieClip

影片剪辑类

(gl)script/apps/Aries/Creator/Game/Movie/MovieClip.lua")
commonlib.gettable("MyCompany.Aries.Game.Movie.MovieClip")

公共方法

MovieClip:CreateNPC()
创建npc

apps->Aries->Creator->Game->Tasks

SelectBlocksTask

选择模块类

(gl)script/apps/Aries/Creator/Game/Tasks/SelectBlocksTask.lua
commonlib.gettable("MyCompany.Aries.Game.Tasks.SelectBlocks")

公共方法

SelectBlocks.FillSelection(fill_block_id)
使用给定的模块填充选择的区域
参数
	fill_block_id -- 所要填充的模块id
SelectBlocks.ReplaceBlocks(from_block_id, to_block_id)
将所选区域的一种模块换成另一种模块