示例#1
0
    /// <summary>
    /// 删除数据
    /// </summary>
    public void DeleteData(string userId, WorldTypeEnum worldType, Vector3Int position)
    {
        string worldName = saveFileName + "_" + EnumExtension.GetEnumName(worldType);
        string fileName  = "w_" + position.x + "_" + position.z;

        BaseDeleteFile(userId + "/" + worldName + "/" + fileName);
    }
示例#2
0
    /// <summary>
    /// 查询数据
    /// </summary>
    /// <returns></returns>
    public ChunkSaveBean QueryData(string userId, WorldTypeEnum worldType, Vector3Int position)
    {
        string worldName = saveFileName + "_" + EnumExtension.GetEnumName(worldType);
        string fileName  = "w_" + position.x + "_" + position.z;

        return(BaseLoadData(userId + "/" + worldName + "/" + fileName));
    }
示例#3
0
    /// <summary>
    /// 更新数据
    /// </summary>
    /// <param name="gameConfig"></param>
    public void UpdateData(ChunkSaveBean data)
    {
        WorldTypeEnum worldType = data.GetWorkType();
        string        worldName = saveFileName + "_" + EnumExtension.GetEnumName(worldType);
        string        fileName  = "w_" + data.position.x + "_" + data.position.z;

        FileUtil.CreateDirectory(dataStoragePath + "/" + data.userId);
        FileUtil.CreateDirectory(dataStoragePath + "/" + data.userId + "/" + worldName);
        if (data.userId != null)
        {
            BaseSaveData(data.userId + "/" + worldName + "/" + fileName, data);
        }
    }
示例#4
0
    /// <summary>
    /// 注册所有方块
    /// </summary>
    public void RegisterBlock()
    {
        List <BlockTypeEnum> listBlockType = EnumExtension.GetEnumValue <BlockTypeEnum>();

        for (int i = 0; i < listBlockType.Count; i++)
        {
            BlockTypeEnum blockType = listBlockType[i];
            //获取方块数据
            BlockInfoBean blockInfo     = GetBlockInfo(blockType);
            string        blockTypeName = EnumExtension.GetEnumName(blockType);
            //通过反射获取类
            Block block = ReflexUtil.CreateInstance <Block>($"BlockType{blockTypeName}");
            if (block == null)
            {
                block = new Block();
            }
            block.SetData(blockType);
            block.blockInfo = blockInfo;
            arrayBlockRegister[(int)blockType] = block;
        }
    }
示例#5
0
 /// <summary>
 /// 设置语言
 /// </summary>
 /// <param name="language"></param>
 public void SetLanguage(LanguageEnum language)
 {
     this.language = EnumExtension.GetEnumName(language);
 }