示例#1
0
        private void DeleteFilesInEssence(Essence essence)
        {
            if (!Directory.Exists(essence.Path))
            {
                Logging.LogWarning(essence.Path + " already deleted.");
                return;
            }
            var sb = new StringBuilder("Deleting Tempory files and directory:\n");

            foreach (var file in essence.Files)
            {
                var absFineName = Path.Combine(essence.Path, file.Value);
                if (File.Exists(absFineName))
                {
                    File.Delete(absFineName);
                    sb.AppendLine(absFineName);
                }
            }

            if (!Directory.EnumerateFiles(essence.Path).Any()) //temp dir is empty, safe to delete
            {
                Directory.Delete(essence.Path);
                sb.AppendLine(essence.Path);
            }
            Logging.LogInfo(sb.ToString());
        }
        private ICurrency EssenceToCurrency(Essence essence)
        {
            Currency.Currency currency = new Currency.Currency();

            currency.Name = essence.Name;

            var rarityRequirement = essence.Level >= 6 ?
                                    new List <RarityOptions>()
            {
                RarityOptions.Normal, RarityOptions.Rare
            } :
            new List <RarityOptions>()
            {
                RarityOptions.Normal
            };

            var rarityValidations = rarityRequirement.Select(x => _currencyRequirementValidator.ValidateRarity(x)).ToArray();


            currency.Requirements.Add(_currencyRequirementValidator.ValidateAny(rarityValidations));

            currency.CurrencyModifiers = new CurrencyModifiers(null, null, essence.ItemLevelRestriction, null, null);

            currency.Steps = new List <Action <Equipment, AffixManager, CurrencyModifiers> >()
            {
                _currencyStepExecutor.SetRarity(RarityOptions.Rare),
                _currencyStepExecutor.RemoveExplicits(ExplicitsOptions.All),
                _currencyStepExecutor.AddExplicitByItemClass(essence.ItemClassToMod),
                _currencyStepExecutor.AddExplicits(DistributionOptions.RareDistribution)
            };

            return(currency);
        }
示例#3
0
        public void GenerateSimpleEditor(Essence essence)
        {
            WriteLine("using UnityEditor;");
            WriteLine("using UnityEngine;");
            WriteLine(string.Empty);
            WriteLine("[CustomEditor(typeof( " + essence.classType.FullName + " ))]");
            WriteLine("public class " + essence.className + " : Editor");
            WriteLine("{");

            if (essence.createContent)
            {
                CreateContent(essence);
            }

            //Space
            WriteLine(string.Empty);
            PrintVariables(essence);

            //Space
            WriteLine(string.Empty);
            PrintOnEnableFunction(essence);

            //Space
            WriteLine(string.Empty);
            PrintGUIFunction(essence);

            PopIndent();
            WriteLine("}");
        }
示例#4
0
        public static int GetID(Essence essence1, Essence essence2)
        {
            int     id = 0;
            Essence topEssence;
            Essence lowEssence;

            if (essence1.ElementCount >= essence2.ElementCount)
            {
                topEssence = essence1;
                lowEssence = essence2;
            }
            else
            {
                topEssence = essence2;
                lowEssence = essence1;
            }


            id = topEssence.EssenceId;
            if (topEssence.ElementCount > 1)
            {
                id <<= 4;
            }
            id |= lowEssence.EssenceId;

            return(id);
        }
示例#5
0
 public void AddEssence(Essence essence)
 {
     CurrentEssence             = essence;
     essence.transform.position = EssenceHolder.position;
     CurrentEssence.gameObject.SetActive(true);
     CurrentEssence.transform.SetParent(EssenceHolder);
 }
示例#6
0
    public static Dictionary <Essence.Type, float> CalculateInteractions(Essence.Type t1, Essence.Type t2)
    {
        var final = new Dictionary <Essence.Type, float>();

        Essence.Type key;
        bool         not_none = (t2 != Essence.Type.none);

        foreach (Essence.Type t in System.Enum.GetValues(typeof(Essence.Type)))
        {
            key        = t;
            final[key] = Essence.GetInteractions(t).ContainsKey(t1) ? Essence.GetEffectivityValue(Essence.GetInteractions(t)[t1]) : 1f;
            //Debug.Log(t1.ToString() + " - " + key + ": " + final[key]);

            if (not_none)
            {
                if (Essence.GetInteractions(t).ContainsKey(t2))
                {
                    final[key] *= Essence.GetEffectivityValue(Essence.GetInteractions(t)[t2]);
                }
                //Debug.Log(t2.ToString() + " - " + key + ": " + final[key]);
            }
        }

        return(final);
    }
示例#7
0
        public void DragTo(Essence essence, Point p, float seconds)
        {
            if (essence == null)
            {
                return;
            }

            //reset everything
            essence.force    = new PointF();
            essence.velocity = new PointF();

            PointF dir, dist, newP, vChange;

            newP = p;
            dir  = f.Dir(essence.p, p);
            dist = dir;

            //realise distance
            essence.p = newP;

            //update velocity:
            //change in v = d/t
            vChange          = f.Divide(dist, seconds);
            essence.velocity = f.Add(essence.velocity, vChange);
            essence.velocity = f.Multiply(essence.velocity, friction);

            CorrectDistance();
        }
示例#8
0
 private void Initialize(Essence essence)
 {
     Unit_To_Producers             = new Dictionary <uint, uint[]>();
     Unit_To_RequiredBuildings     = new Dictionary <uint, uint[]>();
     Research_To_Researcher        = new Dictionary <uint, uint>();
     Research_To_RequiredBuildings = new Dictionary <uint, uint>();
     Research_To_RequiredResearch  = new Dictionary <uint, uint>();
     foreach (var pair in essence.UnitProducers)
     {
         Unit_To_Producers.Add(pair.Key, pair.Values.ToArray());
     }
     foreach (var pair in essence.UnitRequiredBuildings)
     {
         Unit_To_RequiredBuildings.Add(pair.Key, pair.Values.ToArray());
     }
     foreach (var pair in essence.ResearchProducer)
     {
         Research_To_Researcher.Add(pair.Key, pair.Value);
     }
     foreach (var pair in essence.ResearchRequiredBuildings)
     {
         Research_To_RequiredBuildings.Add(pair.Key, pair.Value);
     }
     foreach (var pair in essence.ResearchRequiredResearch)
     {
         Research_To_RequiredResearch.Add(pair.Key, pair.Value);
     }
 }
示例#9
0
        public static bool IsContainsInSynonyms
            (this Essence essence, List <string> inquiriesSynonyms, ICoreferenceInfo coreferenceInfo)
        {
            if (inquiriesSynonyms == null)
            {
                return(true);
            }

            if (Algorithms.IsHomogeneous(essence))
            {
                var elements = Algorithms.GetObjectsFromHomogeneous(essence.Entity, ObjectAllocateMethod.PhysicalOrJuridicalPersons);
                if (elements.Contains(essence.Entity))     //(elements.Count == 1) && (elements.First() == essence.Entity) )
                {
                    elements = Algorithms.GetObjectsFromHomogeneous(essence.Entity, ObjectAllocateMethod.FirstEntityWithTypePronoun);
                }
                var essenceItems = Algorithms.ConstructEssenceItems4Homogeneous(elements, coreferenceInfo);

                essence.SetEssenceItems4Homogeneous(essenceItems);
            }

            foreach (var ei in essence.EssenceItems)
            {
                if (ei.IsContainsInInquiriesSynonyms(inquiriesSynonyms))
                {
                    return(true);
                }
            }
            return(false);
        }
示例#10
0
        public ActionResult GetEssenceByName(string name)
        {
            var model = new Essence();
            var query = from e in dB.Essences.AsQueryable()
                        join b in dB.BaseItems.AsQueryable() on e.Name equals b.ItemName
                        where e.Name == name
                        select new Essence()
            {
                Name             = e.Name,
                Level            = e.Level,
                LevelRestriction = (e.LevelRestriction == BsonNull.Value) ? 0 : e.LevelRestriction,
                SpawnLevelMin    = e.SpawnLevelMin,
                SpawnLevelMax    = e.SpawnLevelMax,
                IsCorruptionOnly = e.IsCorruptionOnly,
                Mods             = e.Mods,
                OtherProperties  = e.OtherProperties,
                VisualIdentity   = b.VisualIdentity,
            };

            model = query.FirstOrDefault();
            SetType(model);
            SetImgSrc(model);

            return(View("GetEssence", model));
        }
示例#11
0
        public bool AddEssence(Essence _essence, Point _inBlockCoords)
        {
            if (_essence is StackOfItems)
            {
                foreach (var tuple in Objects)
                {
                    if (tuple.Item2 == _inBlockCoords && tuple.Item1.Equals(_essence))
                    {
                        var stack = tuple.Item1 as StackOfItems;
                        if (stack != null)
                        {
                            stack.Add((StackOfItems)_essence);
                            return(false);
                        }
                    }
                }
            }
            if (_essence is IRemoteActivation)
            {
                var ra = _essence as IRemoteActivation;
                World.TheWorld.RegisterRemoteActivation(ra.MechanismId, ra, ToWorldCoords(_inBlockCoords));
            }

            Objects.Add(new Tuple <Essence, Point>(_essence, _inBlockCoords));
            return(true);
        }
示例#12
0
		public bool AddEssence(Essence _essence, Point _inBlockCoords)
		{
			if (_essence is StackOfItems)
			{
				foreach (var tuple in Objects)
				{
					if (tuple.Item2 == _inBlockCoords && tuple.Item1.Equals(_essence))
					{
						var stack = tuple.Item1 as StackOfItems;
						if (stack != null)
						{
							stack.Add((StackOfItems)_essence);
							return false;
						}

					}
				}
			}
			if(_essence is IRemoteActivation)
			{
				var ra = _essence as IRemoteActivation;
				World.TheWorld.RegisterRemoteActivation(ra.MechanismId, ra, ToWorldCoords(_inBlockCoords));
			}

			Objects.Add(new Tuple<Essence, Point>(_essence, _inBlockCoords));
			return true;
		}
示例#13
0
 /// <summary>
 /// Abathur client is used to set up the Abathur framework.
 /// </summary>
 /// <param name="setupSettings">File containing list of modules Abathur should include</param>
 /// <param name="gameSettings">Settings for setting up the game with the StarCraft II client</param>
 /// <param name="essence">File containing data that is subject to change due to patches</param>
 /// <param name="log">Optional logging, will be used be the entire framework</param>
 public AbathurClient(AbathurSetup setupSettings, GameSettings gameSettings, Essence essence, ILogger log = null)
 {
     this.setupSettings = setupSettings;
     this.gameSettings  = gameSettings;
     this.essence       = essence;
     this.log           = log;
 }
示例#14
0
        protected void OnEnable()
        {
            m_SelectedItem.Load();
            m_SearchFilter.Load();
            m_MethodName.Load();
            m_MethodAssemblyQualifiedName.Load();
            m_ShowUserAssemblies.Load();
            m_ShowUnityAssemblies.Load();
            m_CreateAnother.Load();
            m_OptionsPageSelection.Load();
            m_Essence       = new Essence();
            m_EssenceEditor = (EssenceEditor)EssenceEditor.CreateEditor(m_Essence, typeof(EssenceEditor));
            m_EssenceEditor.OnEnable();

            m_GeneratorNames = System.Enum.GetNames(typeof(GeneratorTypes));

            for (int i = 0; i < m_GeneratorNames.Length; i++)
            {
                m_GeneratorNames[i] = ObjectNames.NicifyVariableName(m_GeneratorNames[i]);
            }

            m_Types = new List <Type>();
            GetAssemblies();
            PopulateTypes();
        }
示例#15
0
        public async void WhenInsertVerticesConnectedWithEdgeThenAllOfItInsertedTest()
        {
            var graph = new GnomGraph(GraphSettings);
            await graph.Setup();

            var essence             = new Essence($"sample esence {Guid.NewGuid()}");
            var sku                 = new OriginalSkuName(true, $"sample sku {Guid.NewGuid()}", null);
            var skuBelongsToEssence = new SkuBelongsToEssence();

            using (var g = graph.Mutate())
            {
                g.CreateVertex(essence);
                g.CreateVertex(sku);
                g.CreateEdge(sku, skuBelongsToEssence, essence);
            }

            Assert.NotNull(essence.Rid);
            Assert.NotNull(sku.Rid);
            Assert.NotNull(skuBelongsToEssence.Rid);

            using (var g = graph.Mutate())
            {
                g.DeleteVertex(essence);
                g.DeleteVertex(sku);
            }
        }
示例#16
0
    public Essence ExtractEssence()
    {
        var extractedEssence = CurrentEssence;

        CurrentEssence.gameObject.SetActive(false);
        CurrentEssence = null;
        return(extractedEssence);
    }
示例#17
0
 private static void ReprocessEssenceItems4Homogeneous
     (Essence essence, ICoreferenceInfo coreferenceInfo /*, ObjectAllocateMethod objectAllocateMethod*/)
 {
     if (Algorithms.IsHomogeneous(essence))
     {
         var essenceItems = ConstructEssenceItems4Homogeneous(essence.Entity, coreferenceInfo /*, objectAllocateMethod*/);
         essence.SetEssenceItems4Homogeneous(essenceItems);
     }
 }
示例#18
0
    private void Consume(EnemyProgram consumeTarget, List <DungeonTile> tempPath)
    {
        DungeonManager.instance.Wait();
        Essence newEssence = Instantiate(myEssence, consumeTarget.transform.position, Quaternion.identity).GetComponent <Essence>();

        newEssence.Harvest(consumeTarget);
        newEssence.SetCourse(tempPath, this);
        Invoke("AttemptConsume", consumeIntervalTime);
    }
示例#19
0
        public void CorrectDistance(Essence essence)
        {
            if (essence.shell == null)
            {
                return;
            }

            essence.p = essence.shell.p;
        }
示例#20
0
 public void RemoveEssence(Essence _item, Point _inBlockCoords)
 {
     if (!Objects.Remove(new Tuple <Essence, Point>(_item, _inBlockCoords)))
     {
         throw new ApplicationException();
     }
     else
     {
     }
 }
示例#21
0
        public void HasEssenceMod()
        {
            var item = GetTestItem();

            Essence essence = _essenceFactory.Essence.First();

            var affix = essence.ItemClassToMod[item.ItemClass];

            Assert.IsNotNull(affix);
        }
示例#22
0
		public void RemoveEssence(Essence _item, Point _inBlockCoords)
		{
			if (!Objects.Remove(new Tuple<Essence, Point>(_item, _inBlockCoords)))
			{
				throw new ApplicationException();
			}
			else
			{
				
			}
		}
示例#23
0
            private void UseEssence()
            {
                activeEssenceObject      = essencePool.Dequeue();
                activeEssence            = activeEssenceObject.GetComponent <Essence>();
                activeEssence.originCore = entityCore;
                activeEssenceObject.transform.SetParent(null);

                essencePool.Enqueue(activeEssenceObject);

                ActionPhase(); //Sets the stats of our essence.
            }
示例#24
0
 public void OnReDrag()
 {
     if (droppedEssence != null && locked == false)
     {
         GetBack();
         dragNDrop.OnDrag();
         drag           = true;
         _img.sprite    = _defaultImg;
         _img.color     = _defaultColor;
         droppedEssence = null;
     }
     gridGen.OnHexGridExport();
 }
示例#25
0
            internal void Initialization(Transform _blueprintObject) //Creates the physical aspect of the blueprint and pools it for activation. Is called when picked up.
            {
                //Module
                //entityCore = originCore; //Sets the module's entity core to the origin entity.
                blueprintObject = _blueprintObject;

                //Essence
                blankEssence = Instantiate(PrefabLibrary.instance.emptyEssence); //Blank essence contains an empty gameobject with an essence script.

                Essence newEssence = blankEssence.GetComponent <Essence>();

                BuildEssence(blankEssence); //Compile the physical side of our module.
            }
示例#26
0
        private void Eat(Being being, Essence essence)
        {
            env.ai.AddEatenEssence(essence.p);

            env.ai.AllocateEssenceToShell(being, essence);

            being.feeding    = false;
            being.timer_feed = being_feed_timer_start_s;
            being.unsucessful_feeds_short = 0;
            being.unsucessful_feeds_long  = 0;

            env.vis.PlaySound_Being_Eat();
        }
示例#27
0
        public void DragTo(Essence essence, Point p)
        {
            if (essence == null)
            {
                return;
            }

            //reset everything
            essence.force    = new PointF();
            essence.velocity = new PointF();

            essence.p = p;
        }
示例#28
0
 public void Initialize(Essence essence) {
     abilityDictionary = new Dictionary<uint, AbilityData>();
     buffDictionary = new Dictionary<uint, BuffData>();
     upgradeDictionary = new Dictionary<uint, UpgradeData>();
     unitTypeDictionary = new Dictionary<uint, UnitTypeData>();
     foreach (var ability in essence.Abilities)
         abilityDictionary.Add(ability.AbilityId, ability);
     foreach (var buff in essence.Buffs)
         buffDictionary.Add(buff.BuffId, buff);
     foreach (var unitType in essence.UnitTypes)
         unitTypeDictionary.Add(unitType.UnitId, unitType);
     foreach (var upgrade in essence.Upgrades)
         upgradeDictionary.Add(upgrade.UpgradeId, upgrade);
 }
示例#29
0
文件: Visual.cs 项目: diatche/CellSim
 public void Select(Point p, bool hover)
 {
     if (hover)
     {
         //hover select
         selected_hover_being   = SelectBeing(p);
         selected_hover_essence = SelectEssence(p);
     }
     else
     {
         //select
         selected_being = SelectBeing(p);
     }
 }
示例#30
0
    public void OnGetBack()
    {
        //Debug.Log("clicked" + droppedEssence);

        if (droppedEssence != null && locked == false)
        {
            GetBack();
            dragNDrop      = null;
            droppedEssence = null;
            _img.sprite    = _defaultImg;
            _img.color     = _defaultColor;
        }
        gridGen.OnHexGridExport();
    }
示例#31
0
        private Essence CreateEssence(EssenceJson essenceJson)
        {
            Essence essence = new Essence();

            essence.FullName       = essenceJson.FullName;
            essence.Name           = essenceJson.Name;
            essence.RequiredLevel  = (int)(essenceJson?.ItemLevelRestriction ?? 100);
            essence.Description    = essenceItems[essenceJson.Name].Description;
            essence.Tier           = (int)essenceJson.Type.Tier;
            essence.Level          = (int)essenceJson.Level;
            essence.ItemClassToMod = _affixFactory.GetEssenceAffixes(essenceJson.Mods, (int)essenceJson.Level);

            return(essence);
        }
示例#32
0
    private void UpdateText()
    {
        CoinText.text   = Coin.ToString();
        PoisonText.text = Essence.ToString();

        if (UpgradeCoin[UpgradeCount] != -1)
        {
            UpgradeButtonEffect.color = new Color(1, 1, 1, (float)Coin / UpgradeCoin[UpgradeCount]);
        }
        else
        {
            UpgradeButtonEffect.color = Color.white;
        }
    }
示例#33
0
		public EssenceDescriptor(Essence _essence, LiveMapCell _cell, IContainer _container, Creature _creature)
		{
			m_creature = _creature;
			if (_essence is IFaked)
			{
				if (_container != null)
				{
					if (_essence is Item)
					{
						_essence = _container.ResolveFakeItem(_creature, (FakedItem)_essence);
					}
					else
					{
						throw new NotImplementedException("Как так?");
					}
				}
				else if(_cell!=null)
				{
					if (_essence is Item)
					{
						_essence = _cell.ResolveFakeItem(_creature, (FakedItem)_essence);
					}
					else if (_essence is Thing)
					{
						_essence = _cell.ResolveFakeThing(_creature);
					}
					
				}
				else
				{
					throw new NotImplementedException("Как так?");
				}
				
			}
			Essence = _essence;
			LiveCoords = _cell!=null?_cell.LiveCoords:null;
			Container = _container;
		}
示例#34
0
		public override bool Act(Essence _target) { return true; }
示例#35
0
		public abstract bool Act(Essence _target);