public void Wear(Message msg)
    {
        var param = CastHelper.Cast <MainScene.BuyItemParametr>(msg.parametrs);

        Analytics.CustomEvent("BOUGHT_ITEM", new Dictionary <string, object>
        {
            { "type", param.type },
            { "name", param.item_sprite != null ? param.item_sprite.name.ToString() : param.item_texture.name.ToString() }
        });

        if (param.type >= MainScene.ShopItemType.KITCHEN_SET)
        {
            return;
        }

        //msg.Type = MainScene.MainMenuMessageType.DRESS_ITEM;
        //MessageBus.Instance.SendMessage(msg);

        if (!wear_entity.content.bought_textures.Contains(param.item_texture.name))
        {
            wear_entity.content.bought_textures.Add(param.item_texture.name);
        }

        wear_entity.Store();

        DataController.instance.tasks_storage.content["first_shopped"] = true;
        DataController.instance.tasks_storage.Store();
    }
    public void Dress(Message msg)
    {
        var  param  = CastHelper.Cast <MainScene.BuyItemParametr>(msg.parametrs);
        bool finded = false;

        if (param.type >= MainScene.ShopItemType.KITCHEN_SET)
        {
            return;
        }

        for (int i = 0; i < wear_entity.content.wear_items.Count; ++i)
        {
            if (wear_entity.content.wear_items[i].type == param.type)
            {
                finded = true;
                wear_entity.content.wear_items[i].beauty_value = param.beauty_value;
                wear_entity.content.wear_items[i].texture_name = param.item_texture.name;
                break;
            }
        }

        if (!finded)
        {
            wear_entity.content.wear_items.Add(
                new WearItem(param.type, param.item_texture, param.beauty_value));
        }

        wear_entity.Store();
    }
Beispiel #3
0
        /// <summary>
        /// Emits a stloc instruction
        /// </summary>
        /// <param name="instruction">The instruction.</param>
        /// <param name="context">The context.</param>
        /// <param name="builder">The builder.</param>
        public void Emit(Instruction instruction, MethodContext context, BuilderRef builder)
        {
            Code code = instruction.OpCode.Code;

            int index;

            if (code >= Code.Stloc_0 && code <= Code.Stloc_3)
            {
                index = instruction.OpCode.Code - Code.Stloc_0;
            }
            else
            {
                VariableDefinition def = (VariableDefinition)instruction.Operand;
                index = def.Index;
            }

            StackElement element  = context.CurrentStack.Pop();
            ValueRef     data     = element.Value;
            TypeRef      destType = context.LocalTypes[index];

            // Possible cast needed.
            if (element.Type != destType)
            {
                CastHelper.HelpIntAndPtrCast(builder, ref data, ref element.Type, destType, "stloccast");
            }

            LLVM.BuildStore(builder, data, context.LocalValues[index]);
        }
        public async Task GraphQl_Given_Shouldresult()
        {
            // arrange
            Setup();
            var heroRequest = new GraphQLRequest
            {
                Query = @"
                {
                    projects {
                        recent(first: 4) {
                            id
                        }
                    }
                }
            "
            };
            // action
            var graphQlResponse = await _adminConnection.Value.GraphQlPost(heroRequest);

            List <ProjectModel> personType = CastHelper.DynamicCastTo <List <ProjectModel> >(graphQlResponse.Data.projects.recent);

            // assert
            personType.Count.Should().BeGreaterOrEqualTo(1).And.BeLessOrEqualTo(4);
            personType.Should().OnlyContain(x => x.Name == null);
            personType.Should().OnlyContain(x => x.Id != null);
        }
    public void TakeOffPreview(Message msg)
    {
        var param = CastHelper.Cast <MainScene.BuyItemParametr>(msg.parametrs);

        if (param == null)
        {
            return;
        }

        if (param.type >= MainScene.ShopItemType.KITCHEN_SET)
        {
            return;
        }

        for (int i = 0; i < wear_entity.content.wear_items.Count; ++i)
        {
            if (wear_entity.content.wear_items[i].type == param.type)
            {
                msg.Type           = MainScene.MainMenuMessageType.DRESS_ITEM;
                param.item_texture = ResourceHelper.LoadTexture(wear_entity.content.wear_items[i].texture_name);
                msg.parametrs      = param;
                MessageBus.Instance.SendMessage(msg);

                return;
            }
        }

        msg.Type = MainScene.MainMenuMessageType.TAKEOFF_ITEM;
        MessageBus.Instance.SendMessage(msg);
    }
Beispiel #6
0
        /// <summary>
        /// Emits a stfld instruction.
        /// </summary>
        /// <param name="instruction">The instruction.</param>
        /// <param name="context">The context.</param>
        /// <param name="builder">The builder.</param>
        public void Emit(Instruction instruction, MethodContext context, BuilderRef builder)
        {
            StackElement   value = context.CurrentStack.Pop();
            StackElement   obj   = context.CurrentStack.Pop();
            FieldReference field = (FieldReference)instruction.Operand;

            uint index = context.Compiler.Lookup.GetFieldIndex(field);

            ValueRef ptr = LLVM.BuildInBoundsGEP(builder, obj.Value, new ValueRef[] { LLVM.ConstInt(TypeHelper.Int32, 0, false), LLVM.ConstInt(TypeHelper.Int32, index, false) }, "field");

            // Possible cast needed.
            TypeRef destType = TypeHelper.GetTypeRefFromType(field.FieldType);

            if (value.Type != destType)
            {
                CastHelper.HelpIntAndPtrCast(builder, ref value.Value, ref value.Type, destType, "stfldcast");
            }

            ValueRef store = LLVM.BuildStore(builder, value.Value, ptr);

            if (instruction.HasPrefix(Code.Volatile))
            {
                LLVM.SetVolatile(store, true);
            }
        }
Beispiel #7
0
        /// <summary>
        /// Emits a rem instruction.
        /// </summary>
        /// <param name="instruction">The instruction.</param>
        /// <param name="context">The context.</param>
        /// <param name="builder">The builder.</param>
        public void Emit(Instruction instruction, MethodContext context, BuilderRef builder)
        {
            StackElement value2 = context.CurrentStack.Pop();
            StackElement value1 = context.CurrentStack.Pop();

            if (TypeHelper.IsFloatingPoint(value1) || TypeHelper.IsFloatingPoint(value2))
            {
                ValueRef result = LLVM.BuildFRem(builder, value1.Value, value2.Value, "remfp");
                context.CurrentStack.Push(new StackElement(result, value1.ILType, value1.Type));
            }
            else
            {
                CastHelper.HelpIntCast(builder, ref value1, ref value2);
                ValueRef result;

                if (instruction.OpCode.Code == Code.Rem)
                {
                    result = LLVM.BuildSRem(builder, value1.Value, value2.Value, "remsi");
                }
                else /* Rem_Un */
                {
                    result = LLVM.BuildURem(builder, value1.Value, value2.Value, "remui");
                }

                context.CurrentStack.Push(new StackElement(result, value1.ILType, value1.Type));
            }
        }
Beispiel #8
0
        public async Task <IEthereumUser> AddAsyncCall(string login, string password, string firstName, string lastName,
                                                       string info)
        {
            var param = new
            {
                Login     = CastHelper.StringToBytes32(login),
                Password  = CastHelper.StringToBytes32(password),
                FirstName = CastHelper.ToUserNameType(firstName),
                LastName  = CastHelper.ToUserNameType(lastName),
                Info      = CastHelper.ToDescriptionType(info ?? ""),
            };

            // send call to get output value
            var result = await _contractService.AddAsyncCall(
                param.Login, param.Password, param.FirstName, param.LastName, param.Info);

            // send transaction & wait it to be mined
            var transactionHash = await _contractService.AddAsync(_walletAddress,
                                                                  param.Login, param.Password, param.FirstName, param.LastName, param.Info,
                                                                  _gas
                                                                  );

            var receipt = await _contractService.MineAndGetReceiptAsync(transactionHash);

            var user = await _contractService.GetAsyncCall(param.Login);

            return(user.ToReadable());
        }
Beispiel #9
0
    public void TakeOff(Message msg)
    {
        var p = CastHelper.Cast <MainScene.BuyItemParametr>(msg.parametrs);

        switch (p.type)
        {
        case MainScene.ShopItemType.SKIN:
            DataController.instance.catsPurse.skin_beauty = 10;
            skin.SetActive(false);
            break;

        case MainScene.ShopItemType.HEADDRESS_CAP:
            DataController.instance.catsPurse.head_beauty = 0;
            head_cat.SetActive(false);
            break;

        case MainScene.ShopItemType.HEADDRESS_BOW:
            DataController.instance.catsPurse.head_beauty = 0;
            head_bow.SetActive(false);
            break;

        case MainScene.ShopItemType.COLLAR:
            DataController.instance.catsPurse.collar_beauty = 0;
            collar.SetActive(false);
            break;

        case MainScene.ShopItemType.GLASSE:
            DataController.instance.catsPurse.glasses_beauty = 0;
            glasses.SetActive(false);
            break;
        }
    }
Beispiel #10
0
        /// <summary>
        /// Determines minimum using a conversion to normalize type.
        /// </summary>
        public static Computer CreateMinBigIntComputer(ExprEvaluator[] childNodes)
        {
            var typeCaster = CastHelper.GetCastConverter <BigInteger>();

            return(delegate(EventBean[] eventsPerStream, bool isNewData, ExprEvaluatorContext exprEvaluatorContext)
            {
                Object valueResult = null;
                BigInteger?typedResult = null;

                for (int ii = 0; ii < childNodes.Length; ii++)
                {
                    var valueChild = childNodes[ii].Evaluate(new EvaluateParams(eventsPerStream, isNewData, exprEvaluatorContext));
                    if (valueChild == null)
                    {
                        return null;
                    }

                    var typedChild = typeCaster.Invoke(valueChild);
                    if ((typedResult == null) || (typedChild < typedResult.Value))
                    {
                        valueResult = valueChild;
                        typedResult = typedChild;
                    }
                }

                return valueResult;
            });
        }
Beispiel #11
0
        public object Execute <TResult>(string sql, object[] variables, QueryResultMethod queryResultMethod)
        {
            if (queryResultMethod == QueryResultMethod.Delete)
            {
                Db.SlowSQL(sql, variables);
                return(null);
            }
            Type resultType = typeof(TResult);

            if (resultType != typeof(string) && typeof(IEnumerable).IsAssignableFrom(resultType))
            {
                Type resultItemType = resultType.GetGenericArguments().FirstOrDefault();
                if (resultItemType != null)
                {
                    IEnumerable <object> queryResult     = Db.SlowSQL(sql, variables);
                    MethodInfo           castItemsMethod = ReflectionHelper.GetEnumerableCastMethod(resultItemType);
                    return((TResult)castItemsMethod.Invoke(null, new object[] { queryResult }));
                }

                return(Db.SlowSQL <T>(sql, variables));
            }

            var result = Query(sql, variables, queryResultMethod);

            if (result == null)
            {
                return(default(TResult));
            }

            return((TResult)CastHelper.Convert(result, resultType));
        }
Beispiel #12
0
        /// <summary>
        /// Determines maximum using a conversion to normalize type.
        /// </summary>
        public static Computer CreateMaxDoubleComputer(ExprEvaluator[] childNodes)
        {
            var typeCaster = CastHelper.GetCastConverter <Double>();

            return(delegate(EventBean[] eventsPerStream, bool isNewData, ExprEvaluatorContext exprEvaluatorContext)
            {
                Object valueResult = null;
                Double typedResult = Double.MinValue;

                for (int ii = 0; ii < childNodes.Length; ii++)
                {
                    var valueChild = childNodes[ii].Evaluate(new EvaluateParams(eventsPerStream, isNewData, exprEvaluatorContext));
                    if (valueChild == null)
                    {
                        return null;
                    }

                    var typedChild = typeCaster(valueChild);
                    if (typedChild > typedResult)
                    {
                        valueResult = valueChild;
                        typedResult = typedChild;
                    }
                }

                return valueResult;
            });
        }
Beispiel #13
0
        /// <summary>
        /// Emits an add instruction.
        /// </summary>
        /// <param name="instruction">The instruction.</param>
        /// <param name="context">The context.</param>
        /// <param name="builder">The builder.</param>
        public void Emit(Instruction instruction, MethodContext context, BuilderRef builder)
        {
            StackElement value2 = context.CurrentStack.Pop();
            StackElement value1 = context.CurrentStack.Pop();

            if (TypeHelper.IsFloatingPoint(value1) || TypeHelper.IsFloatingPoint(value2))
            {
                ValueRef result = LLVM.BuildFAdd(builder, value1.Value, value2.Value, "addfp");
                context.CurrentStack.Push(new StackElement(result, value1.ILType, value1.Type));
            }
            else
            {
                bool isPtrVal1, isPtrVal2;
                CastHelper.HelpPossiblePtrCast(builder, ref value1, ref value2, out isPtrVal1, out isPtrVal2, "addcast");

                // If one of the two values is a pointer, then the result will be a pointer as well.
                if (isPtrVal1 || isPtrVal2)
                {
                    ValueRef      result          = LLVM.BuildAdd(builder, value1.Value, value2.Value, "addptr");
                    TypeRef       resultingType   = (isPtrVal1 ? value1.Type : value2.Type);
                    TypeReference resultingILType = (isPtrVal1 ? value1.ILType : value2.ILType);
                    ValueRef      ptr             = LLVM.BuildIntToPtr(builder, result, resultingType, "ptr");
                    context.CurrentStack.Push(new StackElement(ptr, resultingILType, resultingType));
                }
                // Cast to different int size.
                else
                {
                    CastHelper.HelpIntCast(builder, ref value1, ref value2);
                    ValueRef result = LLVM.BuildAdd(builder, value1.Value, value2.Value, "addi");
                    context.CurrentStack.Push(new StackElement(result, value1.ILType, value1.Type));
                }
            }
        }
Beispiel #14
0
        public async Task <IEthereumFile> AddAsync(
            string login, string password,
            string type, string hash, long size, string name, string description, DateTime created)
        {
            var param = new
            {
                Login       = CastHelper.StringToBytes32(login),
                Password    = CastHelper.StringToBytes32(password),
                Mime        = CastHelper.StringToBytes32(type),
                Hash        = CastHelper.ToDescriptionType(hash),
                Size        = CastHelper.StringToBytes32(size.ToString()),
                Name        = CastHelper.ToFileNameType(name),
                Description = CastHelper.ToDescriptionType(description),
                Timestamp   = (int)((DateTimeOffset)created).ToUnixTimeSeconds()
            };

            // send call to get output value
            var response = await _contractService.AddFileAsyncCall(
                param.Login, param.Password,
                param.Mime, param.Hash, param.Size, param.Name, param.Description, param.Timestamp);

            // send transaction & wait it to be mined
            var transactionHash = await _contractService.AddFileAsync(
                _walletAddress,
                param.Login, param.Password,
                param.Mime, param.Hash, param.Size, param.Name, param.Description, param.Timestamp,
                _gas);

            var receipt = await _contractService.MineAndGetReceiptAsync(transactionHash);

            return(await GetAsyncCall(login, password, response.Fileindex));
        }
Beispiel #15
0
        public void SpeedUpedTask(Message msg)
        {
            var param = CastHelper.Cast <MainScene.StartTaskParametrs>
                            (msg.parametrs);

            Tasks[param.index].time_wait = 0;
        }
Beispiel #16
0
    public void UpdateCoins(Message m)
    {
        var param = CastHelper.Cast <CommonMessageParametr>(m.parametrs);

        coins.text    = param.obj.ToString();
        coins_st.text = param.obj.ToString();
    }
Beispiel #17
0
    public void UpdateScore(Message m)
    {
        var param = CastHelper.Cast <CommonMessageParametr>(m.parametrs);

        points.text    = param.obj.ToString();
        points_st.text = param.obj.ToString();
    }
Beispiel #18
0
        /// <summary>
        /// Emits a Ldind instruction.
        /// </summary>
        /// <param name="instruction">The instruction.</param>
        /// <param name="context">The context.</param>
        /// <param name="builder">The builder.</param>
        public void Emit(Instruction instruction, MethodContext context, BuilderRef builder)
        {
            Code         code    = instruction.OpCode.Code;
            StackElement pointer = context.CurrentStack.Pop();

            ValueRef ptr     = pointer.Value;
            TypeRef  ptrType = LLVM.PointerType(TypeHelper.GetTypeRefFromStOrLdind(code), 0);

            if (pointer.Type != ptrType)
            {
                CastHelper.HelpIntAndPtrCast(builder, ref ptr, ref pointer.Type, ptrType, "ldindcast");
            }

            ValueRef res = LLVM.BuildLoad(builder, ptr, "elem");

            // Some need to be pushed as an int32 on the stack.
            if (code == Code.Ldind_I1 || code == Code.Ldind_I2 || code == Code.Ldind_I4 ||
                code == Code.Ldind_U1 || code == Code.Ldind_U2 || code == Code.Ldind_U4)
            {
                res = LLVM.BuildIntCast(builder, res, TypeHelper.Int32, "tmp");
            }

            TypeRef type = LLVM.TypeOf(res);

            context.CurrentStack.Push(new StackElement(res, TypeHelper.GetBasicTypeFromTypeRef(type), type));
        }
Beispiel #19
0
    public void Dress(Message msg)
    {
        var param = CastHelper.Cast <MainScene.BuyItemParametr>(msg.parametrs);

        if (param.type < MainScene.ShopItemType.KITCHEN_SET)
        {
            return;
        }

        bool finded = false;

        for (int i = 0; i < wear_entity.content.location_items.Count; ++i)
        {
            if (wear_entity.content.location_items[i].type == param.type)
            {
                finded = true;
                wear_entity.content.location_items[i].res_name =
                    param.item_texture == null ? param.item_sprite.name : param.item_texture.name;
                break;
            }
        }

        if (!finded)
        {
            wear_entity.content.location_items.Add(
                new LocationItem(param.type, param.item_texture == null ? (object)param.item_sprite : (object)param.item_texture, param.item_texture == null ? ResourceType.SPRITE : ResourceType.TEXTURE));
        }

        wear_entity.Store();
    }
Beispiel #20
0
    public void TakeOffPreview(Message msg)
    {
        if (msg.parametrs == null)
        {
            return;
        }

        var param = CastHelper.Cast <MainScene.BuyItemParametr>(msg.parametrs);

        if (param.type < MainScene.ShopItemType.KITCHEN_SET)
        {
            return;
        }

        for (int i = 0; i < wear_entity.content.location_items.Count; ++i)
        {
            if (wear_entity.content.location_items[i].type == param.type)
            {
                msg.Type          = MainScene.MainMenuMessageType.DRESS_ITEM;
                param.item_sprite = ResourceHelper.LoadSprite(wear_entity.content.location_items[i].res_name);
                msg.parametrs     = param;
                MessageBus.Instance.SendMessage(msg);

                return;
            }
        }

        msg.Type          = MainScene.MainMenuMessageType.DRESS_ITEM;
        param.item_sprite = ResourceHelper.LoadSprite(default_sprites[param.type]);
        msg.parametrs     = param;
        MessageBus.Instance.SendMessage(msg);
    }
Beispiel #21
0
        public static async Task DeployContract()
        {
            // 1. Unclock Account
            var unlockTime = new HexBigInteger(120);

            WriteLog($"Unlock account for {unlockTime.Value}s\n" +
                     $"  address: {EV.WalletAddress}\n" +
                     $"  pass: {EV.WalletPassword}\n\n");
            var unlockRes = await _web3.Personal.UnlockAccount.SendRequestAsync(
                EV.WalletAddress, EV.WalletPassword, unlockTime);

            // 2. Deploy contract
            // Get contract receipt & contractAddress, save contractAdress to file
            WriteLog("\nCreate transaction to deploy contract\n" +
                     $"  gas: {_gas.Value}\n" +
                     $"  library address: {EV.LibraryAddress}");

            var adminBytes = new
            {
                login     = CastHelper.StringToBytes32(admin[0]),
                password  = CastHelper.StringToBytes32(admin[1]),
                firstName = CastHelper.ToUserNameType(admin[2]),
                lastName  = CastHelper.ToUserNameType(admin[3]),
                info      = CastHelper.ToDescriptionType(admin[4]),
            };

            WriteLog("\n  Admin:\n" +
                     $"    login:    {admin[0]}\n" +
                     $"    password: {admin[1]}\n" +
                     $"    name:     {admin[2]} {admin[3]}\n" +
                     $"    info:     {admin[4]}");
            WriteLog("\n  . . . Getting hash . . .");

            var transactionHash =
                await UsersAndFilesService.DeployContractAsync(_web3,
                                                               EV.LibraryAddress,
                                                               EV.WalletAddress,
                                                               adminBytes.login,
                                                               adminBytes.password,
                                                               adminBytes.firstName,
                                                               adminBytes.lastName,
                                                               adminBytes.info,
                                                               _gas);

            WriteLog($"  hash: {transactionHash}");

            // 3. Mine transaction
            WriteLog("\nMine transaction\n" +
                     "  . . . Getting receipt . . .");
            var receipt = await UsersAndFilesService.MineAndGetReceiptAsync(_web3, transactionHash);

            WriteLog($"  gas used: {receipt.GasUsed.Value}");

            EV.ContractAddress = receipt.ContractAddress;
            File.WriteAllText(_output, receipt.ContractAddress);

            WriteLog("\n>>>\n" +
                     $">>> Contract Address: {receipt.ContractAddress}\n" +
                     ">>>");
        }
Beispiel #22
0
        public void ShowScanned(Message msg)
        {
            var param = CastHelper.Cast <ScanMenuMessageParametrs>(msg.parametrs);

            int i = 0;

            foreach (string name in param.names)
            {
                Sprite sprite = ResourceHelper.LoadSprite(pets_folder, name);
                scaned_pets_cont.transform.Find("ic (" + i.ToString() + ")").GetComponent <Image>().sprite = sprite;
                ++i;
            }

            for (int j = 0; j < param.max_star_cnt; j++)
            {
                if (j >= param.star_cnt)
                {
                    Color clr = star_cont.transform.Find("Image (" + j.ToString() + ")").GetComponent <Image>().color;
                    clr.a = 0;
                    star_cont.transform.Find("Image (" + j.ToString() + ")").GetComponent <Image>().color = clr;
                }
            }

            float tmp = pb_line.GetComponent <RectTransform>().sizeDelta.y;

            pb_line.GetComponent <RectTransform>().sizeDelta =
                new Vector2((param.star_cnt / (float)param.max_star_cnt) * pb_width, tmp);

            cats_opened.text = TextManager.getText("open_cats") + param.names.Count + "/" + param.max_cats;
        }
Beispiel #23
0
        public void StartTask(Message msg)
        {
            var param = CastHelper.Cast <MainScene.StartTaskParametrs>
                            (msg.parametrs);

            StartTask(param.index);
        }
Beispiel #24
0
        public void Init(Message msg)
        {
            var param = CastHelper.Cast <InitUpdate>(msg.parametrs);

            fx    = param.platform_tr.parent.Find("fx_shrink").GetComponent <ParticleSystem>();
            light = param.platform_tr.parent.Find("light").GetComponent <Light>();
        }
Beispiel #25
0
        public static bool TypeCompatible(VariableType dest, VariableType src, bool coerce = false)
        {
            if (dest is DynamicArrayType destArr && src is DynamicArrayType srcArr)
            {
                return(TypeCompatible(destArr.ElementType, srcArr.ElementType));
            }

            if (dest is ClassType destClassType && src is ClassType srcClassType)
            {
                return(destClassType.ClassLimiter == srcClassType.ClassLimiter || ((Class)srcClassType.ClassLimiter).SameAsOrSubClassOf(destClassType.ClassLimiter.Name));
            }

            if (dest.PropertyType == EPropertyType.Byte && src.PropertyType == EPropertyType.Byte)
            {
                return(true);
            }

            if (dest is DelegateType destDel && src is DelegateType srcDel)
            {
                return(true);
                // this seems like how it ought to be done, but there is bioware code that would have only compiled if all delegates are considered the same type
                // maybe log a warning here instead of an error?
                //return destDel.DefaultFunction.SignatureEquals(srcDel.DefaultFunction);
            }

            if (dest is Class destClass)
            {
                if (src is Class srcClass)
                {
                    bool sameAsOrSubClassOf = srcClass.SameAsOrSubClassOf(destClass.Name);
                    if (srcClass.IsInterface)
                    {
                        return(sameAsOrSubClassOf || destClass.Implements(srcClass));
                    }
                    return(sameAsOrSubClassOf
                           //this seems super wrong obviously. A sane type system would require an explicit downcast.
                           //But to make this work with existing bioware code, it's this, or write a control-flow analyzer that implicitly downcasts based on typecheck conditional gates
                           //I have chosen the lazy path
                           || destClass.SameAsOrSubClassOf(srcClass.Name));
                }

                if (destClass.Name.CaseInsensitiveEquals("Object") && src is ClassType)
                {
                    return(true);
                }
            }

            if (dest.Name.CaseInsensitiveEquals(src?.Name))
            {
                return(true);
            }
            ECast cast = CastHelper.GetConversion(dest, src);

            if (coerce)
            {
                return(cast != ECast.Max);
            }
            return(cast.Has(ECast.AutoConvert));
        }
Beispiel #26
0
        public void IsCastTest_InvalidKeyword()
        {
            List <Token> tokenList = Tokenizer.Tokenize("(char+)");
            bool         expected  = false;
            bool         actual    = CastHelper.IsCast(tokenList);

            Assert.AreEqual(expected, actual);
        }
Beispiel #27
0
        public void InitPlatform(Message m)
        {
            var param = CastHelper.Cast <InitUpdate>(m.parametrs);

            Platform          = param.platform_tr;
            PatternRunes      = param.rune1_templ.gameObject;
            PatternRunesPoint = param.rune2_templ.gameObject;
        }
Beispiel #28
0
        public void OpenAnimShowed(Message msg)
        {
            var p = CastHelper.Cast <UpdateInt>(msg.parametrs);

            DataStorage.content.storable_data[p.value].ready_show = false;
            DataStorage.content.storable_data[p.value].idle       = true;
            DataStorage.Store();
        }
Beispiel #29
0
        public void UpdateTasks(Message msg)
        {
            var        param = CastHelper.Cast <CommonMessageParametr>(msg.parametrs);
            List <int> data  = (List <int>)param.obj;
            int        value = data[0];

            finishing_order.Add(value);
        }
Beispiel #30
0
        public void ActionDone(Message msg)
        {
            var param = CastHelper.Cast <UpdateInt>
                            (msg.parametrs);

            DataStorage.content.storable_data[param.value].current_action_index += 1;
            DataStorage.Store();
        }