示例#1
0
 // Use this for initialization
 void Start()
 {
     option = GameObject.Find("OptionButtons");
     arrow = GameObject.Find("ArrowButtons");
     button2 = option.GetComponent<Animation>();
     button3 = arrow.GetComponent<Animation>();
 }
        private void CustomizeCompomentForKeywordField(Component component)
        {
            component.Schema.RootElementName = "hasKeyword";
            Field headingField = new Field() { Name = "heading", Values = new List<string> { "some heading" } };

            FieldSet metadataFields = new FieldSet();
            metadataFields.Add(headingField.Name, headingField);


            Field keywordField = new Field()
            {
                Name = "keyword",
                KeywordValues = new List<Keyword>() 
                {
                    new Keyword()
                    {
                        MetadataFields = metadataFields,
                        Id = Randomizer.AnyUri(1024),
                        Title = Randomizer.AnyString(33),
                        Description = Randomizer.AnyString(33)
                    }                        
                }
            };
            component.Fields.Add(keywordField.Name, keywordField);
        }
示例#3
0
		void ICmpInitializable.OnShutdown(Component.ShutdownContext context)
		{
			if(context == ShutdownContext.Deactivate)
			{
				DualityApp.Sound.StopAll();
			}
		}
示例#4
0
 public void Should_ImplementInterface()
 {
     var component = new Component(typeof(Dummy)).ForImplementedInterfaces();
     component.WithParameters(new Parameter("Labas", "labas"));
     Assert.IsTrue(component.ComponentRegistration.LookupTypes.Count == 1);
     Assert.IsTrue(component.ComponentRegistration.LookupTypes[0].IsInterface && component.ComponentRegistration.LookupTypes[0].Name=="IDummy");
 }
示例#5
0
    static void Main(string[] args)
    {
        Component motherBoard1 = new Component("AsusP8H67/H67/1155", "Game Station", (decimal)155.00);
        Component graphicCard1 = new Component("ATI Radeon HD7850", (decimal)229.00);
        Component ram1 = new Component("2x4GB DDR3 1600Mhz", (decimal)129.00);
        Computer pc1 = new Computer("Asus Game Machine", new List<Component> { motherBoard1, graphicCard1, ram1 });
        Console.WriteLine(pc1);
        Console.WriteLine();
        Console.WriteLine("----------------------------------------------------------------");
        Component motherBoard2 = new Component("ASUS P8H61-M LX2/SI/LGA1155", "Home Station", (decimal)98.00);
        Component graphicCard2 = new Component("ATI Radeon HD 7750", (decimal)138.00);
        Component ram2 = new Component("4 GB DDR3 1333 MHz", (decimal)65.00);
        Computer pc2 = new Computer("Home Machine", new List<Component> { motherBoard2, graphicCard2, ram2 });
        Console.WriteLine(pc2);
        Console.WriteLine();
        Console.WriteLine("----------------------------------------------------------------");
        Component motherBoard3 = new Component("ASROCK Z87 PRO4 BULK", "Game Station", (decimal)217.00);
        Component graphicCard3 = new Component("SAPPHIRE R9 270 2G GDDR5 OC", (decimal)358.00);
        Component ram3 = new Component("2x4GB DDR3 1600 MHz", (decimal)148.00);
        Computer pc3 = new Computer("Game Machine New", new List<Component> { motherBoard3, graphicCard3, ram3 });
        Console.WriteLine(pc3);
        Console.WriteLine();
        Console.WriteLine("----------------------------------------------------------------");
        Console.WriteLine("----------------------------------------------------------------");
        List<Computer> computers = new List<Computer>() { pc1, pc2, pc3 };
        computers.OrderByDescending(computer => computer.Price).ToList().ForEach(computer => Console.WriteLine(computer.ToString()));

    }
示例#6
0
    public static void MoveTo(this GameObject inMover, Component inLocator, AxisFlags inAxes = AxisFlags.XYZ)
    {
        if(inLocator == null)
            return;

        MoveTo(inMover.transform, inLocator);
    }
示例#7
0
        public int SaveComponent(IComponentDb componentDb, int? transactionNumber = null)
        {
            Component record;
            var recordOld = new Component();
            if (componentDb.ComponentId == 0)
            {
                record = new Component();
                Context.AddToComponents(record);
            }
            else
            {
                record = Context.Components.Where(r => r.ComponentId == componentDb.ComponentId).First();
                ReflectionHelper.CopyAllProperties(record, recordOld);
            }

            record.Name = componentDb.Name;
            record.IsReadOnlyAccess = componentDb.IsReadOnlyAccess;

            Context.SaveChanges();
            if (componentDb.ComponentId == 0)
            {
                componentDb.ComponentId = record.ComponentId;
                LogUnlinkedToDb(UserId, "Components", record.ComponentId, "I", XmlHelper.GetObjectXml(record), transactionNumber);
            }
            else
            {
                LogUnlinkedToDb(UserId, "Components", record.ComponentId, "U", XmlHelper.GetDifferenceXml(recordOld, record), transactionNumber);
            }

            return componentDb.ComponentId;
        }
示例#8
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        /// 

        private void RemovedComponent(Entity e,Component c)
        {
            if (c != null)
            {
                pool.AddComponent(c.GetType(), c);
            }
        }
 public void Deserialize(byte[] data, Component instance)
 {
     UnitySerializer.AddFinalAction(delegate
     {
         Animation animation = (Animation)instance;
         animation.Stop();
         Dictionary<string, AnimationState> dictionary = animation.Cast<AnimationState>().ToDictionary((AnimationState a) => a.name);
         List<SerializeAnimations.StoredState> list = UnitySerializer.Deserialize<List<SerializeAnimations.StoredState>>(data);
         foreach (SerializeAnimations.StoredState current in list)
         {
             if (current.asset != null && !dictionary.ContainsKey(current.name))
             {
                 animation.AddClip(SaveGameManager.Instance.GetAsset(current.asset) as AnimationClip, current.name);
             }
             if (current.name.Contains(" - Queued Clone"))
             {
                 AnimationState instance2 = animation.PlayQueued(current.name.Replace(" - Queued Clone", string.Empty));
                 UnitySerializer.DeserializeInto(current.data, instance2);
             }
             else
             {
                 UnitySerializer.DeserializeInto(current.data, animation[current.name]);
             }
         }
     });
 }
示例#10
0
    public MyJson.IJsonNode Parser(Component com,NeedList list)
    {

        UITexture t = com as UITexture;
        var json = new MyJson.JsonNode_Object();


        if(t.mainTexture!=null)
        {
            string needtex = AtlasMgr.SaveTexture(t.mainTexture, System.IO.Path.Combine(Application.streamingAssetsPath, "nguitex"));
            json["mainTexture"] = new MyJson.JsonNode_ValueString(needtex);
            list.AddDependTexture(needtex);
            if(t.shader!=null)
            {
                string shader = t.shader.name;
                json["shader"] = new MyJson.JsonNode_ValueString(shader);
            }
        }
        else
        {
            Debug.LogWarning("不支持 导出使用材质的UITexture");
        }

        json["uvRect"] = new MyJson.JsonNode_ValueString(ComponentTypeConvert.RectToString(t.uvRect));
        ComponentParser.ParserWidget(json, t);

        return json;

    }
示例#11
0
    void OnManaChange(Component Health, object newMana)
    {
        //If health has changed of this object
        if (this.GetInstanceID() != Health.GetInstanceID()) return;

        Debug.Log("Object: " + gameObject.name + "'s Mana is: " + newMana.ToString());
    }
 public DriveModes(BadgerControlSubsystem badgerControlSubsystem, Component parentComponent, RemoteDriverService remoteDriveService, string serviceName)
 {
     this.badgerControlSubsystem = badgerControlSubsystem;
     this.parentComponent = parentComponent;
     this.remoteDriveService = remoteDriveService;
     this.serviceName = serviceName;
 }
    public void AddListener(Component game_object, string notification_name)
    {
        if (listeners_dictionary.ContainsKey(notification_name))
            listeners_dictionary.Add(notification_name, new List<Component>());

        listeners_dictionary [notification_name].Add (game_object);
    }
示例#14
0
	public void RemoveRenderEventCall(Component tarCom)
	{
		if (m_RenderEventCalls == null)
			m_RenderEventCalls = new List<Component>();
		if (m_RenderEventCalls.Contains(tarCom) == true)
			m_RenderEventCalls.Remove(tarCom);
	}
示例#15
0
        void ICmpInitializable.OnInit(Component.InitContext context)
        {
            if (context == InitContext.Activate && DualityApp.ExecContext != DualityApp.ExecutionContext.Editor)
            {
                AnimSpriteRenderer r = this.GameObj.Renderer as AnimSpriteRenderer;
                SoundEmitter s = this.GameObj.GetComponent<SoundEmitter>();
                Transform t = this.GameObj.Transform;

                r.AnimDuration = MathF.RoundToInt(0.4f * r.AnimDuration * MathF.Rnd.NextFloat(0.8f, 1.25f) * MathF.Sqrt(intensity));
                t.RelativeScale *= MathF.Sqrt(intensity);
                t.RelativeAngle = MathF.Rnd.NextFloat(MathF.RadAngle360);
                t.RelativeVel = new Vector3(MathF.Rnd.NextVector2(1.0f));

                ContentRef<Sound> soundRes = ContentRef<Sound>.Null;
                switch (MathF.Rnd.Next(5))
                {
                    case 0:	soundRes = GameRes.Data.Sound.Explo1_Sound; break;
                    case 1:	soundRes = GameRes.Data.Sound.Explo2_Sound; break;
                    case 2:	soundRes = GameRes.Data.Sound.Explo3_Sound; break;
                    case 3:	soundRes = GameRes.Data.Sound.Explo4_Sound; break;
                    case 4:	soundRes = GameRes.Data.Sound.Explo5_Sound; break;
                }
                SoundEmitter.Source source = new SoundEmitter.Source(soundRes, false);
                source.Volume = MathF.Rnd.NextFloat(0.9f, 1.15f) * MathF.Sqrt(intensity);
                source.Pitch = MathF.Rnd.NextFloat(0.8f, 1.25f) / MathF.Sqrt(intensity);
                source.Paused = false;
                s.Sources.Add(source);
            }
        }
示例#16
0
    //-------------------------------------------------------
    //Function called when health changes
    void OnHealthChange(Component Enemy, int NewHealth)
    {
        //If health has changed of this object
        if(this.GetInstanceID() != Enemy.GetInstanceID()) return;

        Debug.Log ("Object: " + gameObject.name +  " Health is: " + NewHealth.ToString());
    }
示例#17
0
	// Control Function -----------------------------------------------------------------
	public void AddRenderEventCall(Component tarCom)
	{
		if (m_RenderEventCalls == null)
			m_RenderEventCalls = new List<Component>();
		if (m_RenderEventCalls.Contains(tarCom) == false)
			m_RenderEventCalls.Add(tarCom);
	}
	public void AddObserver (Component observer, String name, object sender) {
	    // If the name isn't good, then throw an error and return.
	    if (name == null || name == "") { Debug.Log("Null name specified for notification in AddObserver."); return; }
	    // If this specific notification doens't exist yet, then create it.
		if (!notifications.ContainsKey(name)) {
	        notifications[name] = new List<Component>();
	    }
//	    if (!notifications[name]) {
//	        notifications[name] = new List<Component>();
//	    }
 
	    List<Component> notifyList = (List<Component>)notifications[name];

        // If the list of observers doesn't already contain the one that's registering, then add it.
        //if (!notifyList.Contains(observer)) {
        //    notifyList.Add(observer);
        //}

        bool add = true;
        foreach(Component c in notifyList)
        {
            if(c.gameObject.Equals(observer.gameObject))
            {
                add = false;
            }
        }

        if(add)
        {
            notifyList.Add(observer);
        }
	}
示例#19
0
 public Computer(string name, Component processor, Component graphicsCard, Component motherboard)
 {
     this.Name = name;
     this.processor = processor;
     this.graphicsCard = graphicsCard;
     this.motherboard = motherboard;
 }
示例#20
0
 public Observation(Component.IIdentity entity, Component.IIdentity observable, DateTimeOffset date, Component.IMeasurement measurement)
 {
     Entity = entity;
     Observable = observable;
     Date = date;
     Measurement = measurement;
 }
示例#21
0
	public void Invoke(GameObject target){
		if (finished) {
			return;
		}
		if (!cached && target != null) {
			List<Type> paramTypes=new List<Type>();
			List<object> args1= new List<object>();
			
			foreach(MethodArgument arg in arguments){
				paramTypes.Add(arg.SerializedType);
				args1.Add(arg.Get());
			}
			args=args1.ToArray();
			methodInfo=SerializedType.GetMethod(method,paramTypes.ToArray());
			if(SerializedType==typeof(Component) || SerializedType.IsSubclassOf(typeof(Component))){
				component=target.GetComponent(SerializedType);
			}
		}
		
		try{
			methodInfo.Invoke (component, args);
		}catch{
			
		}
		finished = true;
	}
示例#22
0
		private static List<ComponentListFactor> GetComponents(Component component, bool isMultiply = true)
		{
			if (component is DualFactorComponent)
			{
				var dfc = (DualFactorComponent)component;
				var leftComponent = Componentizer.ToComponent(dfc.LeftFactor);
				var rightComponent = Componentizer.ToComponent(dfc.RightFactor);

				var leftList = GetComponents(leftComponent, isMultiply);
				var rightList = GetComponents(rightComponent, isMultiply == dfc.IsMultiply);

				return leftList.Union(rightList).ToList();
			}

			if (component is IntegerFraction)
			{
				var frac = (IntegerFraction)component;
				return new List<ComponentListFactor>
				{
					new ComponentListFactor(new NumericFactor(new Integer(frac.Numerator))),
					new ComponentListFactor(new NumericFactor(new Integer(frac.Denominator)), false)
				};
			}

			return new List<ComponentListFactor> { new ComponentListFactor(Factorizer.ToFactor(component), isMultiply) };
		}
示例#23
0
    /// <summary>
    /// Bind the source event to the target event handler
    /// </summary>
    public void Bind()
    {
        if( isBound || DataSource == null )
            return;

        if( !DataSource.IsValid || !DataTarget.IsValid )
        {
            Debug.LogError( string.Format( "Invalid event binding configuration - Source:{0}, Target:{1}", DataSource, DataTarget ) );
            return;
        }

        sourceComponent = DataSource.Component;
        targetComponent = DataTarget.Component;

        var eventHandler = DataTarget.GetMethod();
        if( eventHandler == null )
        {
            Debug.LogError( "Event handler not found: " + targetComponent.GetType().Name + "." + DataTarget.MemberName );
            return;
        }

        if( bindToEventProperty( eventHandler ) )
        {
            isBound = true;
            return;
        }

        if( bindToEventField( eventHandler ) )
        {
            isBound = true;
            return;
        }
    }
示例#24
0
    static void Main()
    {
        var HDD = new Component("SSD Intel 530 Ser.", 149.04, "120GB SATA");
        var graphicsCard = new Component("Palit GTX750Ti KalmX", 321.00, "2GB");
        var motherboard = new Component("ASROCK 970 PERFORMANCE", 201.59);
        var processor = new Component("Intel i5-4460", 386.21, "3.2GHz 6MBs.1150");

        var myComponents = new List<Component>();
        myComponents.Add(processor);
        myComponents.Add(HDD);
        myComponents.Add(motherboard);
        myComponents.Add(graphicsCard);

        var hardDiscDrive = new Component("SSD KINGSTON", 190.51, "240GB V300 SATA3");
        var videoCard = new Component("Palit Nvidia", 197.10, " GT740 2GB DDR5");
        var CPU = new Component("AMD A8", 205.44, "X4 7650K BOX s.FM2+");
        var monitor = new Component("23\'\' Samsung", 321.00, " C23A750X Wireles");

        var yourComponents = new List<Component>() { hardDiscDrive, videoCard, CPU, monitor};

        var computer = new Computer("MyComputer", myComponents);
        var secondComputer = new Computer("YourComputer",yourComponents);

        var computers = new List<Computer>() { computer, secondComputer };

        computers.OrderBy(c => c.Price).ToList().ForEach(c => Console.WriteLine(c.ToString()));
    }
        /// <summary>
        /// Gets the raw string (xml) from the broker db by URL
        /// </summary>
        /// <param name="Url">URL of the page</param>
        /// <returns>String with page xml or empty string if no page was found</returns>
        public string GetContentByUrl(string Url)
        {
            Page page = new Page();
            page.Title = Randomizer.AnyString(15);
            page.Id = Randomizer.AnyUri(64);
            page.Filename = Randomizer.AnySafeString(8) + ".html";

            PageTemplate pt = new PageTemplate();
            pt.Title = Randomizer.AnyString(20);
            Field ptfieldView = new Field();
            ptfieldView.Name = "view";
            ptfieldView.Values.Add("Standard");
            pt.MetadataFields = new FieldSet();
            pt.MetadataFields.Add(ptfieldView.Name, ptfieldView);

            page.PageTemplate = pt;

            Schema schema = new Schema();
            schema.Title = Randomizer.AnyString(10);

            Component component = new Component();
            component.Title = Randomizer.AnyString(30);
            component.Id = Randomizer.AnyUri(16);
            component.Schema = schema;

            Field field1 = Randomizer.AnyTextField(6, 120, true);
            Field field2 = Randomizer.AnyTextField(8, 40, false);

            FieldSet fieldSet = new FieldSet();
            fieldSet.Add(field1.Name, field1);
            fieldSet.Add(field2.Name, field2);
            component.Fields = fieldSet;

            ComponentTemplate ct = new ComponentTemplate();
            ct.Title = Randomizer.AnyString(20);
            Field fieldView = new Field();
            fieldView.Name = "view";
            fieldView.Values.Add("DefaultComponentView");
            ct.MetadataFields = new FieldSet();
            ct.MetadataFields.Add(fieldView.Name, fieldView);

            ComponentPresentation cp = new ComponentPresentation();
            cp.Component = component;
            cp.ComponentTemplate = ct;

            page.ComponentPresentations = new List<ComponentPresentation>();
            page.ComponentPresentations.Add(cp);

            FieldSet metadataFields = new FieldSet();
            page.MetadataFields = metadataFields;

            var serializer = new XmlSerializer(typeof(Page));
            StringBuilder builder = new StringBuilder();
            StringWriter writer = new StringWriter(builder);
            //XmlTextWriter writer = new XmlTextWriter(page.Filename, Encoding.UTF8);
            //serializer.Serialize(writer, page);
            serializer.Serialize(writer, page);
            string pageAsString = builder.ToString();
            return pageAsString;
        }
示例#26
0
 public FadeOutAnimation(Component i_BoundSprite)
     : base(i_BoundSprite)
 {
     m_TimeLeft = r_FadeEffectTimeSpan;
     m_AnimationTime = r_FadeEffectTimeSpan;
     m_BoundSprite.Opacity = 100;
 }
示例#27
0
    public MyJson.IJsonNode Parser(Component com, NeedList needlist)
    {

        UISlider t = com as UISlider;
        var json = new MyJson.JsonNode_Object();

        json["value"] = new MyJson.JsonNode_ValueNumber(t.value);
        json["alpha"] = new MyJson.JsonNode_ValueNumber(t.alpha);
        json["numberOfSteps"] = new MyJson.JsonNode_ValueNumber(t.numberOfSteps);
        if (t.foregroundWidget != null)
        {
            json["foregroundWidget"] = new MyJson.JsonNode_ValueNumber(GameObjParser.ObjToID(t.foregroundWidget.gameObject));
        }
        if (t.backgroundWidget != null)
        {
            json["backgroundWidget"] = new MyJson.JsonNode_ValueNumber(GameObjParser.ObjToID(t.backgroundWidget.gameObject));
        }
        if (t.thumb != null)
        {
            json["thumb"] = new MyJson.JsonNode_ValueNumber(GameObjParser.ObjToID(t.thumb.gameObject));
        }
        json["fillDirection"] = new MyJson.JsonNode_ValueString(t.fillDirection.ToString());

        return json;

    }
示例#28
0
 public static void AddHealth(Component entity, int health)
 {
     HealthHandler handler = entity.GetComponent<HealthHandler>();
     if (handler) {
         handler.AddHealth(health);
     }
 }
        public string Format(Component component)
        {
            Regex variable = new Regex("\\$[a-zA-z]+ ");
            string plainVars = variable.Replace(Value, new MatchEvaluator(delegate(Match match)
            {
                string propertyName = match.Value.Replace("$", "").Trim().ToLowerInvariant();
                ComponentProperty propertyInfo = component.FindProperty(propertyName);
                if (propertyInfo != null)
                    return component.GetProperty(propertyInfo).ToString();
                return "";
            }));

            variable = new Regex("\\$[a-zA-Z]+[\\(\\)a-z_0-9]+ ");
            string formattedVars = variable.Replace(plainVars, new MatchEvaluator(delegate(Match match)
            {
                Regex propertyNameRegex = new Regex("\\$[a-zA-z]+");
                string propertyName = propertyNameRegex.Match(match.Value).Value.Replace("$", "").Trim().ToLowerInvariant();
                ComponentProperty propertyInfo = component.FindProperty(propertyName);
                if (propertyInfo != null)
                {
                    return ApplySpecialFormatting(component.GetProperty(propertyInfo), match.Value.Replace(propertyNameRegex.Match(match.Value).Value, "").Trim());
                }
                return "";
            }));

            Regex regex = new Regex(@"\\[uU]([0-9A-F]{4})");
            return regex.Replace(formattedVars, match => ((char)Int32.Parse(match.Value.Substring(2), NumberStyles.HexNumber)).ToString());
        }
    public static void Main()
    {
        Console.Title = "Problem 3.	PC Catalog";

        Component monitor = new Component("monitor", 200);
        Component keyboard = new Component("keyboard", 43);
        Component mouse = new Component("mouse", 15);

        Component motherboard = new Component("motherboard", "G560 Intel Motherboard LA-5752P", 540);
        Component HDD = new Component("HDD", "256GB SSD", 188);
        Component proccesor = new Component("processor", " Intel Pentium G6950 (2.80 GHz, 3 MB)", 433);

        Computer firstPC = new Computer("Lenovo", motherboard, proccesor, HDD, monitor, mouse, keyboard);
        Computer secondPC = new Computer("HP", motherboard, proccesor, HDD, monitor);
        Computer thirdPC = new Computer("Acer", motherboard, proccesor, HDD);

        Computer[] pcArr = { firstPC, secondPC, thirdPC };
        pcArr = pcArr.OrderBy(pc => pc.Price()).ToArray();

        foreach (Computer pc in pcArr)
        {
            Console.WriteLine(pc.ToString());
        }

        Console.WriteLine("{0}\nMake your best choice!", new string('.', 25));
    }
示例#31
0
 public abstract void Convert(Component unityComponent, Entity entity, RectTransformToEntity rectTransformToEntity, Dictionary <UnityEngine.Object, Entity> assetToEntity, EntityManager mgr);
示例#32
0
 public static int DOPlayBackwards(this Component target)
 {
     return(DOTween.PlayBackwards(target));
 }
示例#33
0
 public static int DOPlayForward(this Component target)
 {
     return(DOTween.PlayForward(target));
 }
示例#34
0
 public static int DOPause(this Component target)
 {
     return(DOTween.Pause(target));
 }
示例#35
0
 public static int DOGoto(this Component target, float to, bool andPlay = false)
 {
     return(DOTween.Goto(target, to, andPlay));
 }
示例#36
0
 public static int DOFlip(this Component target)
 {
     return(DOTween.Flip(target));
 }
示例#37
0
 public static int DOKill(this Component target, bool complete = false)
 {
     return(DOTween.Kill(target, complete));
 }
示例#38
0
 public static int DOComplete(this Component target)
 {
     return(DOTween.Complete(target));
 }
示例#39
0
 public static IObservable <T> RepeatUntilDisable <T>(this IObservable <T> source, Component target)
 {
     return(RepeatUntilCore(RepeatInfinite(source), target.OnDisableAsObservable(), (target != null) ? target.gameObject : null));
 }
示例#40
0
 public override void Convert(Component unityComponent, Entity entity, RectTransformToEntity rectTransformToEntity, Dictionary <UnityEngine.Object, Entity> assetToEntity, EntityManager mgr)
 {
     ConvertComponent((T)unityComponent, entity, rectTransformToEntity, assetToEntity, mgr);
 }
示例#41
0
        private List <Observation> GetObservations(Component component, List <Hardware> hardware)
        {
            List <Observation> observations = new List <Observation>();

            if (component == Component.CPUSpeed)
            {
                foreach (Hardware current in hardware)
                {
                    observations.Add(new Observation(current.ReleaseDate, current.ProcessorCoreSpeed * current.ProcessorCoreCount));
                }
            }
            else if (component == Component.InternalStorageSpace)
            {
                foreach (Hardware current in hardware)
                {
                    observations.Add(new Observation(current.ReleaseDate, current.InternalStorageSpace));
                }
            }
            else if (component == Component.RAM)
            {
                foreach (Hardware current in hardware)
                {
                    observations.Add(new Observation(current.ReleaseDate, current.RAM));
                }
            }
            else if (component == Component.FrontCameraMegapixel)
            {
                foreach (Hardware current in hardware)
                {
                    observations.Add(new Observation(current.ReleaseDate, current.FrontCameraMegapixel));
                }
            }
            else if (component == Component.RearCameraMegapixel)
            {
                foreach (Hardware current in hardware)
                {
                    observations.Add(new Observation(current.ReleaseDate, current.RearCameraMegapixel));
                }
            }
            else if (component == Component.MaxFramerateMaxResolution)
            {
                foreach (Hardware current in hardware)
                {
                    observations.Add(new Observation(current.ReleaseDate, current.MaxFramerateMaxResolution));
                }
            }
            else if (component == Component.MaxFramerateMinResolution)
            {
                foreach (Hardware current in hardware)
                {
                    observations.Add(new Observation(current.ReleaseDate, current.MaxFramerateMinResolution));
                }
            }
            else if (component == Component.BatteryCapacity)
            {
                foreach (Hardware current in hardware)
                {
                    observations.Add(new Observation(current.ReleaseDate, current.BatteryCapacity));
                }
            }
            else if (component == Component.Volume)
            {
                foreach (Hardware current in hardware)
                {
                    observations.Add(new Observation(current.ReleaseDate, (current.Height * current.Depth * current.Width)));
                }
            }
            else if (component == Component.Price)
            {
                foreach (Hardware current in hardware)
                {
                    observations.Add(new Observation(current.ReleaseDate, current.OriginalPrice));
                }
            }
            else
            {
                throw new Exception("Component not found in enum.");
            }
            return(observations);
        }
示例#42
0
 public async Task <RedirectResult> LuTest1Done(string txid)
 {
     //return Redirect(await executionManager.RaiseOutcomeAsync(new TXID(txid), new ComponentDoneOutcome()));
     return(Redirect(await Component.RedirectRaiseOutcomeAsync(txid, new ComponentDoneOutcome())));
 }
示例#43
0
        public static void HieGUI(int instanceID, Rect rect)
        {
            // Check
            Object tempObj = EditorUtility.InstanceIDToObject(instanceID);

            if (!tempObj)
            {
                return;
            }


            // fix rect
            rect.width += rect.x;
            rect.x      = 0;


            // Logic
            GameObject       obj  = tempObj as GameObject;
            List <Component> coms = new List <Component>(obj.GetComponents <Component>());

            for (int i = 0; i < coms.Count; i++)
            {
                if (!coms[i])
                {
                    continue;
                }
                if (TypeCheck(coms[i].GetType()))
                {
                    coms.RemoveAt(i);
                    i--;
                }
            }

            int iconSize = 16;
            int y        = 1;
            int offset   = obj.transform == OffsetObject ? Offset : 0;

            // Main
            for (int i = 0; i + offset < coms.Count && i < MAX_ICON_NUM; i++)
            {
                Component com = coms[i + offset];

                // Logic
                Texture2D texture = AssetPreview.GetMiniThumbnail(com);

                if (texture)
                {
                    GUI.DrawTexture(new Rect(
                                        rect.width - (iconSize + 1) * (i + 1),
                                        rect.y + y,
                                        iconSize,
                                        iconSize
                                        ), texture);
                }
            }


            // More Button
            if (coms.Count == MAX_ICON_NUM + 1)
            {
                Texture2D texture = AssetPreview.GetMiniThumbnail(coms[coms.Count - 1]);
                if (texture)
                {
                    GUI.DrawTexture(new Rect(
                                        rect.width - (iconSize + 1) * (coms.Count - 1 + 1),
                                        rect.y + y,
                                        iconSize,
                                        iconSize
                                        ), texture);
                }
            }
            else if (coms.Count > MAX_ICON_NUM)
            {
                GUIStyle style = new GUIStyle(GUI.skin.label);
                style.fontSize  = 9;
                style.alignment = TextAnchor.MiddleCenter;

                if (GUI.Button(new Rect(
                                   rect.width - (iconSize + 2) * (MAX_ICON_NUM + 1),
                                   rect.y + y,
                                   22,
                                   iconSize
                                   ), "•••", style))
                {
                    if (OffsetObject != obj.transform)
                    {
                        OffsetObject = obj.transform;
                        Offset       = 0;
                    }
                    Offset += MAX_ICON_NUM;
                    if (Offset >= coms.Count)
                    {
                        Offset = 0;
                    }
                }
            }
        }
示例#44
0
 public static IObservable <T> TakeUntilDisable <T>(this IObservable <T> source, Component target)
 {
     return(source.TakeUntil(target.OnDisableAsObservable()));
 }
        #pragma warning disable 1998
        public async override global::System.Threading.Tasks.Task ExecuteAsync()
        {
            BeginContext(0, 40, true);
            WriteLiteral("<!DOCTYPE html>\r\n\r\n<html lang=\"pt-br\">\r\n");
            EndContext();
            BeginContext(40, 936, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("head", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "42970ba7906de4f59b3b0e805c82caf3e38684354401", async() => {
                BeginContext(46, 100, true);
                WriteLiteral("\r\n    <meta charset=\"utf-8\">\r\n    <meta name=\"viewport\" content=\"width=device-width\" />\r\n    <title>");
                EndContext();
                BeginContext(147, 13, false);
#line 7 "C:\Users\lucas\Documents\Git\asp-net-core-2.2-Loja-Virtual\MultiMarket\MultiMarket\Views\Shared\_Layout.cshtml"
                Write(ViewBag.Title);

#line default
#line hidden
                EndContext();
                BeginContext(160, 809, true);
                WriteLiteral(@"</title>

    <meta name=""description"" content=""Loja Virtual em ASP.NET"">
    <meta name=""author"" content=""Elias Ribeiro"">
    <link rel=""stylesheet"" type=""text/css"" href=""/css/Confs.css"" />
    <link rel=""stylesheet"" href=""/resources/lib/bootstrap-4.2.1-dist/css/bootstrap.min.css"">
    <link rel=""stylesheet"" href=""/resources/lib/caroussel/carousel.css"" />
    <link rel=""stylesheet"" href=""/resources/lib/bootstrap-ecommerce-uikit/css/ui.css"" />
    <link rel=""stylesheet"" href=""/resources/lib/bootstrap-ecommerce-uikit/css/responsive.css"" media=""only screen and (max-width: 1200px)"" />
    <link rel=""stylesheet"" href=""https://use.fontawesome.com/releases/v5.6.3/css/all.css"" integrity=""sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/""
          crossorigin=""anonymous"">
");
                EndContext();
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_HeadTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_HeadTagHelper);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(976, 2, true);
            WriteLiteral("\r\n");
            EndContext();
            BeginContext(978, 1190, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("body", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "42970ba7906de4f59b3b0e805c82caf3e38684356915", async() => {
                BeginContext(984, 147, true);
                WriteLiteral("\r\n    <script src=\"/resources/lib/holder/holder.min.js\"></script>\r\n    <script src=\"/resources/lib/jquery3.3.1/jquery-3.3.1.min.js\"></script>\r\n    ");
                EndContext();
                BeginContext(1131, 63, false);
                __tagHelperExecutionContext = __tagHelperScopeManager.Begin("script", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "42970ba7906de4f59b3b0e805c82caf3e38684357452", async() => {
                }
                                                                            );
                __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>();
                __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper);
                __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0);
                await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
                if (!__tagHelperExecutionContext.Output.IsContentModified)
                {
                    await __tagHelperExecutionContext.SetOutputContentAsync();
                }
                Write(__tagHelperExecutionContext.Output);
                __tagHelperExecutionContext = __tagHelperScopeManager.End();
                EndContext();
                BeginContext(1194, 6, true);
                WriteLiteral("\r\n    ");
                EndContext();
                BeginContext(1200, 63, false);
                __tagHelperExecutionContext = __tagHelperScopeManager.Begin("script", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "42970ba7906de4f59b3b0e805c82caf3e38684358707", async() => {
                }
                                                                            );
                __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>();
                __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper);
                __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1);
                await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
                if (!__tagHelperExecutionContext.Output.IsContentModified)
                {
                    await __tagHelperExecutionContext.SetOutputContentAsync();
                }
                Write(__tagHelperExecutionContext.Output);
                __tagHelperExecutionContext = __tagHelperScopeManager.End();
                EndContext();
                BeginContext(1263, 162, true);
                WriteLiteral("\r\n    <script src=\"/resources/lib/popper1.14.6/popper.min.js\"></script>\r\n    <script src=\"/resources/lib/bootstrap-4.2.1-dist/js/bootstrap.min.js\"></script>\r\n    ");
                EndContext();
                BeginContext(1425, 48, false);
                __tagHelperExecutionContext = __tagHelperScopeManager.Begin("script", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "42970ba7906de4f59b3b0e805c82caf3e386843510128", async() => {
                }
                                                                            );
                __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>();
                __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper);
                __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2);
                await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
                if (!__tagHelperExecutionContext.Output.IsContentModified)
                {
                    await __tagHelperExecutionContext.SetOutputContentAsync();
                }
                Write(__tagHelperExecutionContext.Output);
                __tagHelperExecutionContext = __tagHelperScopeManager.End();
                EndContext();
                BeginContext(1473, 24, true);
                WriteLiteral("\r\n    <header>\r\n        ");
                EndContext();
                BeginContext(1498, 35, false);
#line 28 "C:\Users\lucas\Documents\Git\asp-net-core-2.2-Loja-Virtual\MultiMarket\MultiMarket\Views\Shared\_Layout.cshtml"
                Write(await Component.InvokeAsync("Menu"));

#line default
#line hidden
                EndContext();
                BeginContext(1533, 36, true);
                WriteLiteral("\r\n    </header>\r\n    <div>\r\n        ");
                EndContext();
                BeginContext(1570, 12, false);
#line 31 "C:\Users\lucas\Documents\Git\asp-net-core-2.2-Loja-Virtual\MultiMarket\MultiMarket\Views\Shared\_Layout.cshtml"
                Write(RenderBody());

#line default
#line hidden
                EndContext();
                BeginContext(1582, 193, true);
                WriteLiteral("\r\n    </div>\r\n    <hr class=\"featurette-divider\">\r\n\r\n    <!-- FOOTER -->\r\n    <footer class=\"container\">\r\n        <p class=\"float-right\"><a href=\"#\">Back to top</a></p>\r\n        <p>&copy; 2017-");
                EndContext();
                BeginContext(1776, 17, false);
#line 38 "C:\Users\lucas\Documents\Git\asp-net-core-2.2-Loja-Virtual\MultiMarket\MultiMarket\Views\Shared\_Layout.cshtml"
                Write(DateTime.Now.Year);

#line default
#line hidden
                EndContext();
                BeginContext(1793, 368, true);
                WriteLiteral(@" - MultiMarket. &middot; <a href=""#"">Privacy</a> &middot; <a href=""#"">Terms</a></p>
    </footer>

    <!-- Bootstrap core JavaScript
          ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <!-- Just to make our placeholder images work. Don't actually copy the next line! -->
");
                EndContext();
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_BodyTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_BodyTagHelper);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(2168, 11, true);
            WriteLiteral("\r\n</html>\r\n");
            EndContext();
        }
示例#46
0
 public HardwareForecast(Component component, List <Hardware> hardware)
 {
     m_hardware     = hardware;
     m_observations = GetObservations(component, hardware);
     ForecastExistingObservations();
 }
示例#47
0
 public UnityBehaviorExecution(Component comp, MethodInfo method)
 {
     this.m_Component = comp;
     this.m_Method    = method;
 }
        /// <summary>
        /// 读取谷歌书签文件
        /// </summary>
        /// <param name="filePath">文件路径</param>
        /// <returns></returns>
        public static Root ReadFile(string filePath)
        {
            using (var fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
            {
                using (StreamReader streamReader = new StreamReader(fileStream, new UTF8Encoding(false)))
                {
                    Stack <Folder> stack         = new Stack <Folder>();
                    Component      prevComponent = null;
                    Root           result        = new Root();
                    Folder         current       = null;
                    int            order         = 0;
                    string         line;

                    while ((line = streamReader.ReadLine()) != null)
                    {
                        line = line.TrimStart();

                        if (line.StartsWith("<TITLE>"))
                        {
                            result.Title = GetLabelText(line);
                            continue;
                        }

                        if (line.StartsWith("<H1>"))
                        {
                            current       = CreateFolder("H1", line, prevComponent);
                            current.Order = order;
                            prevComponent = null;
                            order         = 0;
                            continue;
                        }

                        if (line.StartsWith("<DT><H3"))
                        {
                            stack.Push(current);
                            current       = CreateFolder("H3", line, prevComponent);
                            current.Order = order;
                            prevComponent = null;
                            order         = 0;
                            continue;
                        }

                        if (line.StartsWith("<DT><A"))
                        {
                            var bookmark = CreateBookmark(line, prevComponent);
                            bookmark.Order = order;
                            prevComponent  = bookmark;
                            order++;
                            current.Add(bookmark);
                            continue;
                        }

                        if (line.StartsWith("</DL><p>") && stack.Count > 0)
                        {
                            order         = current.Order + 1;
                            prevComponent = current;
                            var temp = stack.Pop();
                            temp.Add(current);
                            current = temp;
                            continue;
                        }
                    }

                    result.Folder = current;
                    return(result);
                }
            }
        }
 public static void RemoveTag(this Component cmp, Tag tag)
 {
     cmp.gameObject.RemoveTag(tag);
 }
示例#50
0
    public bool Interact(GameObject gameobject)
    {
        CharacterInventory characterInventory = gameobject.GetComponent <CharacterInventory> ();

        Debug.Assert(characterInventory != null);
        bool foundSlotForItem = false;

        Component   component = GetComponent(typeof(IObjectData));
        IObjectData objData   = component as IObjectData;

        if (objData.stackable())
        {
            for (int i = 0; i < characterInventory.INVENTORY_SIZE; ++i)
            {
                if (characterInventory.inventory[i] != null)
                {
                    Component   comp       = characterInventory.inventory[i].GetComponent(typeof(IObjectData));
                    IObjectData objectData = comp as IObjectData;

                    // This equality check is hacky. It incorrectly assumes every
                    // object in the game will have a unique name.
                    if (objectData.objectName() == objData.objectName())
                    {
                        objectData.increaseCount(objData.count());
                        foundSlotForItem = true;
                        // We added this item to a stack.
                        Destroy(gameObject);
                        break;
                    }
                }
            }
        }

        if (!foundSlotForItem)
        {
            for (int i = 0; i < characterInventory.INVENTORY_SIZE; ++i)
            {
                if (characterInventory.inventory[i] == null)
                {
                    // Assign the inventory slot to this gameObject (not the one that was passed in).
                    characterInventory.inventory[i] = gameObject;
                    foundSlotForItem = true;
                    break;
                }
            }
        }

        if (foundSlotForItem)
        {
            gameObject.transform.position = gameobject.transform.position;
            QuestTriggerWrapper qt = GetComponent <QuestTriggerWrapper> ();
            if (qt != null)
            {
                GameObject.Find("QuestManager").GetComponent <QuestManager>().ProcessQuestTrigger(qt.questTrigger);
            }
            if (gameObject.activeInHierarchy)
            {
                gameObject.SetActive(false);
            }
        }
        return(foundSlotForItem);
    }
 public static bool HasTag(this Component cmp, Tag tag)
 {
     return(cmp.gameObject.HasTag(tag));
 }
 public static Tag PrefabID(this Component cmp)
 {
     return(cmp.gameObject.PrefabID());
 }
示例#53
0
 public void AddComponent(Component component)
 {
     streams.Add(component);
 }
 public static void AddTag(this Component cmp, Tag tag)
 {
     cmp.gameObject.AddTag(tag);
 }
示例#55
0
 /// <summary>
 /// Object has to use callback functions.
 /// </summary>
 /// <param name="target">target class that will receive the callbacks.</param>
 public void InitCallBacks(Component target)
 {
     callBackTargets.Add(target);
 }
示例#56
0
 public void RemoveComponent(Component component)
 {
     streams.Remove(component);
 }
示例#57
0
 public static int DORewind(this Component target, bool includeDelay = true)
 {
     return(DOTween.Rewind(target, includeDelay));
 }
示例#58
0
 /// <summary>
 /// 搜索子物体组件-Component版
 /// </summary>
 public static T Get <T>(Component go, string subnode) where T : Component
 {
     return(go.transform.FindChild(subnode).GetComponent <T>());
 }
示例#59
0
 public static int DOSmoothRewind(this Component target)
 {
     return(DOTween.SmoothRewind(target));
 }
 public override void LoadToObject(Component game)
 {
     LoadToObject(game, ref data);
 }