Пример #1
0
        private void GenerateFields(ICollection <CustomDataValueViewModel> data)
        {
            if (EntityType == null)
            {
                return;
            }

            data.Where(x => EntityType.EntityCustomFields.All(y => y.Name != x.Name)).ToList().ForEach(x => data.Remove(x));

            foreach (var cf in EntityType.EntityCustomFields)
            {
                var customField = cf;
                var d           = data.FirstOrDefault(x => x.Name == customField.Name);
                if (d == null)
                {
                    var customDataValue = new CustomDataValue {
                        Name = cf.Name, CustomField = cf
                    };
                    data.Add(new CustomDataValueViewModel(customDataValue, CustomDataValueUpdating));
                }
                else
                {
                    d.CustomField = cf;
                }
            }
        }
Пример #2
0
            public static void FuncWithValueT([Blob(BlobPath)] CustomDataValue value)
            {
                // default(T) is blob is missing
#pragma warning disable xUnit2002 // Do not use null check on value type
                Assert.NotNull(value);
#pragma warning restore xUnit2002 // Do not use null check on value type
                Assert.Equal(0, value.ValueId);
            }
    public override void click()
    {
        Logger.Log("the game will " + itemName + "...");

        CustomDataValue modeValue = GameConfiguration.GameMode.ADVENTURE == MemoryManager.get().configuration.getMode() ? CustomDataValue.SANDBOX : CustomDataValue.ADVENTURE;

        RedMetricsManager.get().sendEvent(TrackingEvent.SELECTMENU, new CustomData(CustomDataTag.OPTION, modeValue.ToString()));

        GameStateController.get().goToOtherGameMode();
    }
Пример #4
0
 public CustomDataValueViewModel(CustomDataValue model, Func <EntityCustomField, string, string, bool> action)
 {
     Model          = model;
     SetValueAction = action;
 }
Пример #5
0
            public void Initialize(ExtensionConfigContext context)
            {
                context.AddConverter <Stream, PocoBlob>(s =>
                {
                    TextReader reader = new StreamReader(s);
                    string text       = reader.ReadToEnd();
                    return(new PocoBlob {
                        Value = text
                    });
                });

                context.AddConverter <ApplyConversion <PocoBlob, Stream>, object>(p =>
                {
                    PocoBlob value = p.Value;
                    Stream stream  = p.Existing;

                    TextWriter writer = new StreamWriter(stream);
                    writer.WriteAsync(value.Value).GetAwaiter().GetResult();
                    writer.FlushAsync().GetAwaiter().GetResult();

                    return(null);
                });

                context.AddConverter <Stream, CustomDataObject>(s =>
                {
                    // Read() shouldn't be called if the stream is missing.
                    Assert.False(true, "If stream is missing, should never call Read() converter");
                    return(null);
                });

                context.AddConverter <ApplyConversion <CustomDataObject, Stream>, object>(p =>
                {
                    CustomDataObject value = p.Value;
                    Stream stream          = p.Existing;

                    if (value != null)
                    {
                        Assert.AreEqual(TestValue, value.ValueId);

                        const byte ignore = 0xFF;
                        stream.WriteByte(ignore);
                    }

                    return(null);
                });

                context.AddConverter <Stream, CustomDataValue>(s =>
                {
                    // Read() shouldn't be called if the stream is missing.
                    Assert.False(true, "If stream is missing, should never call Read() converter");
                    return(default(CustomDataValue));
                });

                context.AddConverter <ApplyConversion <CustomDataValue, Stream>, object>(p =>
                {
                    CustomDataValue value = p.Value;
                    Stream stream         = p.Existing;

                    Assert.AreEqual(TestValue, value.ValueId);

                    const byte ignore = 0xFF;
                    stream.WriteByte(ignore);

                    return(null);
                });
            }
Пример #6
0
 public static void FuncWithOutValueT([Blob(BlobPath)] out CustomDataValue value)
 {
     value = new CustomDataValue {
         ValueId = TestValue, Content = "ignore"
     };
 }
Пример #7
0
 public static void FuncWithValueT([Blob(BlobPath)] CustomDataValue value)
 {
     // default(T) is blob is missing
     Assert.NotNull(value);
     Assert.AreEqual(0, value.ValueId);
 }