public CCLabelContent() { gear = CCFactory.Instance.takeGear(CCFactory.KEY_LABEL); gear.gameObject.name = "content"; // gear.gameObject.transform.localScale = new Vector3 (1, 1, 1); this.mesh.color = Color.white; mesh.characterSize = 0.05f; mesh.anchor = TextAnchor.MiddleCenter; mesh.alignment = TextAlignment.Center; }
protected override void initWithGear(CCFactoryGear gear) { base.initWithGear(gear); _gear.gameObject.name = "Sprite"; _gear.gameObject.transform.localPosition = Vector3.zero; // _gear.gameObject.transform.localScale = new Vector3 (1, 1, 1); _content = new CCSpriteContent(); _content.gameObject.transform.parent = gameObject.transform; // _content.renderer.sortingOrder = 1; }
protected virtual void initWithGear(CCFactoryGear gear) { _gear = gear; _gear.gameObject.name = "Node"; _gear.gameObject.transform.localPosition = Vector3.zero; // _gear.gameObject.transform.localScale = new Vector3 (1, 1, 1); _isRunning = false; // _skewX = _skewY = 0.0f; _rotation = 0.0f; _scaleX = _scaleY = 1.0f; _position = Vector2.zero; _contentSize = Vector2.zero; _anchorPointInPixels = _anchorPoint = Vector2.zero; // "whole screen" objects. like Scenes and Layers, should set ignoreAnchorPointForPosition to YES _ignoreAnchorPointForPosition = false; _isUpdateTransformDirty = _isTransformDirty = _isInverseDirty = true; // _vertexZ = 0; // _grid = nil; _visible = true; _userTag = null; _zOrder = 0; // lazy alloc // _camera = nil; // children (lazy allocs) _children = null; // userData is always inited as nil _userObject = null; //initialize parent to nil _parent = null; // _shaderProgram = nil; _orderOfArrival = 0; // _glServerState = 0; // set default scheduler and actionManager CCDirector director = CCDirector.sharedDirector; this.actionManager = director.actionManager; this.scheduler = director.scheduler; }
CCFactoryGear buildGear(Type[] componentTypes) { CCFactoryGear gear = new CCFactoryGear(); GameObject obj = new GameObject(); gear.gameObject = obj; Component[] coms = new Component[componentTypes.Length]; for (int j = 0; j < componentTypes.Length; j++) { coms[j] = obj.AddComponent(componentTypes[j]); } gear.components = coms; return(gear); }
public bool recycleGear(string category, CCFactoryGear gear, bool constraint = false) { Storage storage = getStorage(category, true); if (storage.componentTypeNames == null) { string[] componentTypeNames = new string[gear.components.Length]; for (int i = 0; i < componentTypeNames.Length; i++) { componentTypeNames [i] = gear.components [i].GetType().FullName; } storage.componentTypeNames = componentTypeNames; } else if (constraint) { if (storage.componentTypeNames.Length != gear.components.Length) { return(false); } else { HashSet <string> typeSet = new HashSet <string>(storage.componentTypeNames); int count = gear.components.Length; for (int i = 0; i < count; i++) { Component com = gear.components[i]; string tName = com.GetType().FullName; if (!typeSet.Remove(tName)) { return(false); } } } } gear.gameObject.transform.parent = transform; gear.gameObject.transform.localEulerAngles = Vector3.zero; gear.gameObject.transform.localScale = new Vector3(1, 1, 1); gear.gameObject.transform.localPosition = Vector3.zero; gear.gameObject.name = string.Format("{0}-{1}", category, storage.gears.Count); gear.gameObject.hideFlags = HideFlags.HideInHierarchy; gear.gameObject.SetActive(false); storage.gears.Add(gear); return(true); }
protected virtual void init() { CCFactoryGear gear = CCFactory.Instance.takeGear(CCFactory.KEY_NODE); initWithGear(gear); }