Example #1
0
        /// <summary>
        /// LUA结构支持
        /// </summary>
        /// <returns></returns>
        public override void GetLuaStruct(StringBuilder code)
        {
            base.GetLuaStruct(code);
            int idx;

            if (!string.IsNullOrWhiteSpace(Friend))
            {
                code.AppendLine($@"['Friend'] = '{Friend.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['Friend'] = nil,");
            }

            code.AppendLine($@"['FriendKey'] ='{FriendKey}',");

            code.AppendLine($@"['LocalCommand'] ={(LocalCommand.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(CommandId))
            {
                code.AppendLine($@"['CommandId'] = '{CommandId.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['CommandId'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(NotifyEntity))
            {
                code.AppendLine($@"['NotifyEntity'] = '{NotifyEntity.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['NotifyEntity'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(ClientEntity))
            {
                code.AppendLine($@"['ClientEntity'] = '{ClientEntity.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['ClientEntity'] = nil,");
            }

            code.AppendLine($@"['IsCommandResult'] ={(IsCommandResult.ToString().ToLower())},");

            code.AppendLine($@"['IsMulit'] ={(IsMulit.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(Org))
            {
                code.AppendLine($@"['Org'] = '{Org.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['Org'] = nil,");
            }

            if (EsEntity != null)
            {
                code.AppendLine($@"['EsEntity'] = {EsEntity.GetLuaStruct()},");
            }

            if (LocalEntity != null)
            {
                code.AppendLine($@"['LocalEntity'] = {LocalEntity.GetLuaStruct()},");
            }
        }