public void Update(int id, ConditionViewModel viewModel)
        {
            if (!conditionDataManager.HasConditionData(id))
            {
                return;
            }

            var data = conditionDataManager.GetConditionData(id);

            for (int i = 0; i < ConditionViewModel.ParametersCount; ++i)
            {
                viewModel.GetParameter(i).IsUsed = false;
            }

            if (data.Parameters != null)
            {
                int j = 0;
                foreach (var param in data.Parameters)
                {
                    viewModel.GetParameter(j).IsUsed      = true;
                    viewModel.GetParameter(j).Name        = param.Name;
                    viewModel.GetParameter(j++).Parameter = parameterFactory.Factory(param.Type);
                }
            }

            viewModel.UpdateCondition(data);
        }
Exemplo n.º 2
0
        public SmartCondition ConditionFactory(int id)
        {
            if (!conditionDataManager.HasConditionData(id))
            {
                throw new NullReferenceException("No data for condition id " + id);
            }

            SmartCondition ev  = new(id, currentCoreVersion.Current.SmartScriptFeatures.SupportsConditionTargetVictim);
            var            raw = conditionDataManager.GetConditionData(id);

            SetParameterObjects(ev, raw);

            return(ev);
        }
Exemplo n.º 3
0
        public SmartCondition ConditionFactory(int id)
        {
            if (!conditionDataManager.HasConditionData(id))
            {
                throw new NullReferenceException("No data for condition id " + id);
            }

            SmartCondition ev  = new(id);
            var            raw = conditionDataManager.GetConditionData(id);

            SetParameterObjects(ev, raw);

            return(ev);
        }