예제 #1
0
        public void Creates_objects()
        {
            var module = new ComplexModule();

            var service = module.GetInstance <IService>();
            var other   = module.GetInstance <IOtherService>();

            Assert.IsNotNull(service);
            Assert.IsNotNull(other);
        }
예제 #2
0
        static void Main(string[] args)
        {
            var       bootstrapper = new Bootstrapper();
            IBuilder  builder      = bootstrapper.GetBuilder();
            IDirector director     = bootstrapper.GetDirector();

            ConfigureBuilder(builder);
            director.Construct(builder);

            ComplexModule complexModule = builder.Result;

            complexModule.LogSettings();

            Console.ReadKey();
        }
예제 #3
0
    public void Init(ComplexModule module)
    {
        Regex  rgx = new Regex("[^a-zA-Z0-9 -]");
        string alphCombinationString = rgx.Replace(module.CombinationString, "");

        List <char> alphaChars = alphCombinationString.OrderBy(c => c).ToList();

        for (int i = 0; i < _comboSlots.Count; i++)
        {
            bool negate     = false;
            int  alphaIndex = module.CombinationString.IndexOf(alphaChars[i]);
            if (alphaIndex > 0)
            {
                if (module.CombinationString[alphaIndex - 1] == '!')
                {
                    negate = true;
                }
            }

            _comboSlots[i].Init(module.Submodules[i], !negate);
        }
    }
예제 #4
0
    public void Init(ComplexModule module)
    {
        if (_editingModule != null)
        {
            _editingModule.OnSubmoduleSeted -= SubmoduleSeted;
        }
        foreach (Transform t in transform)
        {
            t.gameObject.SetActive(false);
        }

        int templateIndex = GetTemplateIndex(module.CombinationString);

        GameObject template = transform.GetChild(templateIndex).gameObject;

        template.SetActive(true);
        _activeTemplate = template.GetComponent <CombinationTemplatePanel>();
        _activeTemplate.Init(module);

        if (_editingModule != null)
        {
            _editingModule.OnSubmoduleSeted += SubmoduleSeted;
        }
    }
예제 #5
0
 public void ConstructComplexModule()
 {
     Result = new ComplexModule(_categoryId, IsInLimitedMode, Factor, InitialPrice, ModuleX, _moduleY);
 }