private static CycleObject GetFreeObject() { lock (LockObj) { var count = Objects.Count; for (var i = 0; i < count; i++) { var co = Objects[i]; if (!co.Use) { return(co); } } //create new if (Count >= InitCount) { ZLogger.Warning("over init capacity, auto increasing count"); } var cObject = new CycleObject { Obj = new ZObject(), Use = true, }; Objects.Add(cObject); Count++; return(cObject); } }
public ComboMenuButton(string name, string labelText, CycleObject cycleObject, Point location, object referenceObject) : base(name, labelText, new Rectangle(location.X, location.Y, 750, 60), cycleObject, referenceObject) { drawSpriteBack = true; spriteBack = GraphicsManager.GetSpriteColour(3); transparency = 0.6f; label = new Label("label", Font.CarterOne20, Color.White, CalcVectorOffset(new Vector2(20, 10)), false, labelText); button = new ButtonBlueLarge("button", CalcPointOffset(new Point(500, 5)), cycleObject.displayName, Color.White); }
public ComboButton(string name, string labelText, Rectangle location, CycleObject cycleObject, object referenceObject) { this.name = name; this.cycleObject = cycleObject; this.referenceObject = referenceObject; preScaleLocation = location; SetSize(); }
public void Cycles() { var original = new CycleObject(); original.Cycle = original; var serialized = original.SerializeToString(); serialized.ShouldEqual( "{\"$type\":\"" + typeof(CycleObject).ToSerializableName() + "\"," + "\"$id\":\"0\",\"Cycle\":{\"$ref\":\"0\"}}"); }
public void AddCycleObject(CycleObject cycleObject) { cycleObjectList.Add(cycleObject); SetScaleVisuals(); }