public override void SendTo(IPlayer player, ObjectVisibility visibility) { Debug.Assert(visibility != ObjectVisibility.None); var data = new EnvironmentObjectData(); CollectObjectData(data, visibility); player.Send(new Messages.ObjectDataMessage(data)); var sw = Stopwatch.StartNew(); SendMapTiles(player); sw.Stop(); Trace.TraceInformation("Sending MapTiles took {0} ms", sw.ElapsedMilliseconds); foreach (var ob in this.Contents) { var vis = player.GetObjectVisibility(ob); if (vis != ObjectVisibility.None) { ob.SendTo(player, vis); } } player.Send(new Messages.ObjectDataEndMessage() { ObjectID = this.ObjectID }); }
public bool canSeeObject(GameObject gameObject) { Vector2 origin = this.transform.position; Vector2 target = gameObject.transform.position; RaycastHit2D hit = new RaycastHit2D(); if (sightBlocked != 0 && (hit = Physics2D.Raycast(origin, target - origin, float.MaxValue, sightBlocked))) { if ((target - origin).sqrMagnitude > hit.distance * hit.distance) { return(false); } } if (damageableOnly && gameObject.GetComponent <Damageable>() == null) { return(false); } ObjectVisibility visibility = gameObject.GetComponent <ObjectVisibility>(); if (visibility != null) { return((canSee & visibility.visibilityLayers) != 0); } return(true); }
private static ObjectVisibility RecoverVisibility(KBObject obj) { string objModule = obj.Module.Name; string objName = obj.Name; ObjectVisibility objVisibility = ObjectVisibility.Private; foreach (EntityReference reference in obj.GetReferencesTo()) { KBObject objRef = KBObject.Get(obj.Model, reference.From); if (objRef != null && reference.ReferenceType == ReferenceType.Hard && Functions.isRunable(obj)) { if (objRef is Artech.Genexus.Common.Objects.Attribute && obj is Procedure) { objVisibility = ObjectVisibility.Public; } else { if (Functions.isRunable(objRef)) { string objRefModule = objRef.Module.Name; if (objRefModule != objModule) { objVisibility = ObjectVisibility.Public; } } } } } return(objVisibility); }
public EClass(string NullOrName, object content, ObjectVisibility visibility, bool istatic, bool isuser = false, string NullOrNamespace = null) { Content = content; if (NullOrName == null && (Content.GetType() == typeof(Type) || Content.GetType().Name == "RuntimeType")) { var c = (Type)Content; NullOrName = c.Name; } if (NullOrNamespace == null && (Content.GetType() == typeof(Type) || Content.GetType().Name == "RuntimeType")) { var c = (Type)Content; NullOrNamespace = c.Namespace; } if (Content.GetType() != typeof(Type) && Content.GetType().Name != "RuntimeType") { throw new NotImplementedException($"Attemption to create EClass with '{Content.GetType().Name}' type. (not supported)"); } Name = NullOrName; Visibility = visibility; IsUser = isuser; Namespace = NullOrNamespace; IsStatic = istatic; }
public EMethodNew(string name, object content, ObjectVisibility visibility, bool istatic, bool isuser = false) { Name = name; Content = content; Visibility = visibility; IsUser = isuser; IsStatic = istatic; }
protected override void CollectObjectData(BaseGameObjectData baseData, ObjectVisibility visibility) { base.CollectObjectData(baseData, visibility); var data = (ItemData)baseData; data.ItemID = this.ItemID; }
void Awake(){ normal_material = GetComponent<Renderer> ().material; panic_material = Resources.Load<Material>(panic_material_name); if (visible == null) visible = GetComponent<ObjectVisibility> (); if (basket == null) basket = GetComponentInParent<BasketComponent> (); }
protected override void CollectObjectData(BaseGameObjectData baseData, ObjectVisibility visibility) { base.CollectObjectData(baseData, visibility); var data = (EnvironmentObjectData)baseData; data.VisibilityMode = this.VisibilityMode; data.Size = this.Size; }
protected override void CollectObjectData(BaseGameObjectData baseData, ObjectVisibility visibility) { base.CollectObjectData(baseData, visibility); var data = (MovableObjectData)baseData; data.Container = this.Container != null ? this.Container.ObjectID : ObjectID.NullObjectID; data.Location = this.Location; }
public static void SetSketchTransparency(Document document, Node sketchNode, ObjectVisibility visibility) { var nodes = GetSketchNodes(sketchNode, document, true); foreach (var node in nodes) { node.Set <DrawingAttributesInterpreter>().Visibility = visibility; } }
public override void SendTo(IPlayer player, ObjectVisibility visibility) { var items = this.Inventory.AsEnumerable(); // filter non-worn and non-wielded if not private visibility if ((visibility & ObjectVisibility.Private) == 0) items = items.OfType<ItemObject>().Where(o => o.IsEquipped); foreach (var o in items) o.SendTo(player, visibility); }
void Start(){ input = InputController.main; if (visibility == null){ visibility = GetComponent<ObjectVisibility>(); } GetComponent<Button>().onClick.AddListener(()=>{ if (visibility.visible){ input.invoke_dir(direction); } }); }
private static ObjectVisibility TableVisibility(Table tbl) { ObjectVisibility objVisibility = ObjectVisibility.Private; foreach (Transaction trn in tbl.AssociatedTransactions) { if (trn.GetPropertyValue <ObjectVisibility>("ObjectVisibility") == ObjectVisibility.Public) { objVisibility = ObjectVisibility.Public; } } return(objVisibility); }
protected virtual void CollectObjectData(BaseGameObjectData baseData, ObjectVisibility visibility) { Debug.Assert(visibility != ObjectVisibility.None); baseData.ObjectID = this.ObjectID; baseData.CreationTime = this.CreationTime; baseData.CreationTick = this.CreationTick; baseData.Properties = SerializeProperties(). Where(kvp => (PropertyVisibilities.GetPropertyVisibility(kvp.Key) & visibility) != 0). Select(kvp => new KeyValuePair <PropertyID, object>(kvp.Key, kvp.Value)). ToArray(); }
public override void SendTo(IPlayer player, ObjectVisibility visibility) { var items = this.Contents.AsEnumerable(); // filter non-worn and non-wielded if not private visibility if ((visibility & ObjectVisibility.Private) == 0) { items = items.OfType <ItemObject>().Where(o => o.IsEquipped); } foreach (var o in items) { o.SendTo(player, visibility); } }
// Use this for initialization void Start () { StrawberryStateMachine berry_state = StrawberryStateMachine.main; automata = gameObject.GetComponent<Automata> (); visibility = gameObject.GetComponent<ObjectVisibility>(); Initialize(); drag = gameObject.GetComponent<DragHandle>(); drag.register_incoming (berry_state.fsm.transition("field_drag")) .register_incoming (berry_state.fsm.transition("fall_drag")) .register_incoming (berry_state.fsm.transition("hand_drag")) .register_state (berry_state.fsm.state("drag")) .register_outgoing(berry_state.fsm.transition("drag_fall")); foreach(BasketComponent basket in BasketComponent.baskets){ drag.register_incoming(basket.remove); } }
public void SendTo(IPlayer player, ObjectVisibility visibility) { if ((visibility & ObjectVisibility.Private) != 0) { // Send all objects without a parent. Those with a parent will be sent in the inventories of the parents foreach (var ob in m_objectMap.Values) { var sob = ob as MovableObject; if (sob == null || sob.Container == null) { ob.SendTo(player, ObjectVisibility.All); } } } }
public override void SendTo(IPlayer player, ObjectVisibility visibility) { Debug.Assert(visibility != ObjectVisibility.None); var data = new LivingData(); CollectObjectData(data, visibility); player.Send(new Messages.ObjectDataMessage(data)); base.SendTo(player, visibility); player.Send(new Messages.ObjectDataEndMessage() { ObjectID = this.ObjectID }); }
protected override void CollectObjectData(BaseGameObjectData baseData, ObjectVisibility visibility) { base.CollectObjectData(baseData, visibility); var data = (LivingData)baseData; data.LivingID = this.LivingID; if ((visibility & ObjectVisibility.Private) != 0) { data.CurrentAction = this.CurrentAction; data.ActionPriority = this.ActionPriority; data.ActionTicksUsed = this.ActionTicksUsed; data.ActionTotalTicks = this.ActionTotalTicks; data.Skills = m_skillMap.Select(kvp => new KeyValuePair <SkillID, byte>(kvp.Key, kvp.Value)).ToArray(); } }
public override void Deserialize(AttributeData data) { //Color info _hasNoColor = data.ReadAttributeInteger("HasNoColor") != 0; HasColorSet = data.ReadAttributeInteger("HasColor") != 0; var red = data.ReadAttributeInteger("Red"); var greem = data.ReadAttributeInteger("Green"); var blue = data.ReadAttributeInteger("Blue"); _color = Color.FromArgb(255, red, greem, blue); //Transparency info HasTransparency = data.ReadAttributeInteger("HasTransparency") != 0; _transparency = data.ReadAttributeDouble("Transparency"); //Display info _displayMode = (AISDisplayMode)data.ReadAttributeInteger("DisplayMode"); _visibility = (ObjectVisibility)data.ReadAttributeInteger("Visibility"); _selectionEnabled = data.ReadAttributeInteger("EnableSelection") == 1 ? true : false; OnModified(); }
public static void MarkPublicObjects() { IKBService kbserv = UIServices.KB; IOutputService output = CommonServices.Output; bool success = true; string title = "KBDoctor - Mark Public Object"; output.StartSection(title); string outputFile = Functions.CreateOutputFile(kbserv, title); KBDoctorXMLWriter writer = new KBDoctorXMLWriter(outputFile, Encoding.UTF8); writer.AddHeader(title); writer.AddTableHeader(new string[] { "Object", "Type", "Description", "Visibility" }); MakeAllObjectPublic(kbserv, output); foreach (KBObject obj in kbserv.CurrentModel.Objects.GetAll()) { output.AddLine("Object " + obj.Name); ICallableObject callableObject = obj as ICallableObject; if (((callableObject != null) || obj is ExternalObject || obj is SDT || obj is DataSelector) && (!(obj is Transaction))) { ObjectVisibility objVisibility = obj.GetPropertyValue <ObjectVisibility>("ObjectVisibility"); ObjectVisibility newObjVisibility = RecoverVisibility(obj); if (objVisibility != newObjVisibility) { obj.SetPropertyValue("ObjectVisibility", newObjVisibility); Functions.SaveObject(output, obj); string objNameLink = Functions.linkObject(obj); writer.AddTableData(new string[] { objNameLink, obj.TypeDescriptor.Name, obj.Description, newObjVisibility.ToString() }); output.AddLine("....Change Object " + obj.Name); } } } output.AddLine(""); output.EndSection(title, success); writer.AddFooter(); writer.Close(); KBDoctorHelper.ShowKBDoctorResults(outputFile); }
private static void MakeAllObjectPublic(IKBService kbserv, IOutputService output) { bool ToContinue = true; int cant = 0; do { ToContinue = false; cant = 1; foreach (KBObject obj in kbserv.CurrentModel.Objects.GetAll()) { ObjectVisibility objVisibility = obj.GetPropertyValue <ObjectVisibility>("ObjectVisibility"); if (objVisibility != ObjectVisibility.Public && Functions.isRunable(obj) && !(obj is Transaction)) { obj.SetPropertyValue("ObjectVisibility", ObjectVisibility.Public); Functions.SaveObject(output, obj); ToContinue = true; cant += 1; } } output.AddLine("Cambio " + cant.ToString()); } while (ToContinue); }
protected override void CollectObjectData(BaseGameObjectData baseData, ObjectVisibility visibility) { base.CollectObjectData(baseData, visibility); var data = (LivingData)baseData; data.LivingID = this.LivingID; if ((visibility & ObjectVisibility.Private) != 0) { data.CurrentAction = this.CurrentAction; data.ActionPriority = this.ActionPriority; data.ActionTicksUsed = this.ActionTicksUsed; data.ActionTotalTicks = this.ActionTotalTicks; data.ActionUserID = this.ActionUserID; data.Skills = m_skillMap.Select(kvp => new Tuple<SkillID, byte>(kvp.Key, kvp.Value)).ToArray(); } }
public void SendTo(IPlayer player, ObjectVisibility visibility) { if ((visibility & ObjectVisibility.Private) != 0) { // Send all objects without a parent. Those with a parent will be sent in the inventories of the parents foreach (var ob in m_objectMap.Values) { var sob = ob as MovableObject; if (sob == null || sob.Container == null) ob.SendTo(player, ObjectVisibility.All); } } }
void init_parent(ObjectVisibility initial = null){ if (obs_parent == null) obs_parent = new ReactiveProperty<ObjectVisibility>(initial); }
public abstract void SendTo(IPlayer player, ObjectVisibility visibility);
public override void SendTo(IPlayer player, ObjectVisibility visibility) { Debug.Assert(visibility != ObjectVisibility.None); var data = new EnvironmentObjectData(); CollectObjectData(data, visibility); player.Send(new Messages.ObjectDataMessage(data)); var sw = Stopwatch.StartNew(); SendMapTiles(player); sw.Stop(); Trace.TraceInformation("Sending MapTiles took {0} ms", sw.ElapsedMilliseconds); foreach (var ob in this.Contents) { var vis = player.GetObjectVisibility(ob); if (vis != ObjectVisibility.None) ob.SendTo(player, vis); } player.Send(new Messages.ObjectDataEndMessage() { ObjectID = this.ObjectID }); }
void Start(){ vis = ObjectVisibility.GetVisibility(gameObject, vis); hide(); }
void Start () { if (vis == null) vis = GetComponent<ObjectVisibility>(); vis.visible = GameSettingsComponent.working_rules.flags.cheats; }
public static ObjectVisibility GetVisibility(GameObject obj, ObjectVisibility existing){ if (existing != null) return existing; if (obj.GetComponent<ObjectVisibility>() == null) return obj.AddComponent<ObjectVisibility>(); return obj.GetComponent<ObjectVisibility>(); }
public override void SendTo(IPlayer player, ObjectVisibility visibility) { Debug.Assert(visibility != ObjectVisibility.None); var data = new ItemData(); CollectObjectData(data, visibility); player.Send(new Messages.ObjectDataMessage(data)); base.SendTo(player, visibility); player.Send(new Messages.ObjectDataEndMessage() { ObjectID = this.ObjectID }); }
private static string[] ModuleStats2(Module mdl) { IOutputService output = CommonServices.Output; IKBService kbserv = UIServices.KB; KBModel kbModel = UIServices.KB.CurrentModel; /* * * Dependencias Entrantes * Dependencias Salientes * IE = Salientes / (Entrantes + Salientes) #Componentes Conexos dentro del módulo. * Tiene dependencia cíclicla ? * Largo máximo de dependencias en la que participa. * El módulo tiene objetos públicos no referenciados por externos? */ int cantobj = 0; int cantobjmain = 0; int cantobjPub = 0; int cantInRef = 0; int cantOutRef = 0; foreach (KBObject obj in mdl.GetAllMembers()) { cantobj += 1; string aux = ""; bool isReferencedFromOutside = IsReferencedFromOutside(mdl, obj, out aux); ObjectVisibility objVisibility = RecoverObjectVisibility(obj); if (Functions.isRunable(obj)) { if (objVisibility == ObjectVisibility.Public) { cantobjPub += 1; } if (!isReferencedFromOutside) { cantInRef += 1;; } } } //Hago lo mismo para las tablas del modulo. IList <KBObject> tblList = (from r in Table.GetAll(kbModel) where TablesHelper.TableModule(kbModel, r) == mdl select kbModel.Objects.Get(r.Key)).ToList(); int cntTables = 0; int cntPublicTables = 0; foreach (Table tbl in tblList) { cntTables += 1; string tableName = tbl.Name; ObjectVisibility visibility = TableVisibility(tbl); if (visibility == ObjectVisibility.Public) { cntPublicTables += 1; } string objOutsideModuleAccessPrivateTable = ""; bool TableReferencedFromOutside = IsReferencedFromOutside(mdl, (KBObject)tbl, out objOutsideModuleAccessPrivateTable); if (TableReferencedFromOutside) { cantInRef += 1;; } } int rel = (cantobj == 0 ? 0 : (cantobjPub * 100) / cantobj); string[] mdlStats = new string[] { Functions.linkObject(mdl), mdl.Description, cntTables.ToString(), cntPublicTables.ToString(), cantobj.ToString(), cantobjPub.ToString(), rel.ToString() + " %", cantInRef.ToString(), cantOutRef.ToString() }; return(mdlStats); }
private static string[] ModuleStats(Module mdl) { IOutputService output = CommonServices.Output; IKBService kbserv = UIServices.KB; KBModel kbModel = UIServices.KB.CurrentModel; string listPubObjNotReferenced = ""; string listPirvateObjReferenced = ""; string ListobjOutsideModuleAccessPrivateTable = ""; foreach (KBObject obj in mdl.GetAllMembers()) { string aux = ""; bool isReferencedFromOutside = IsReferencedFromOutside(mdl, obj, out aux); ObjectVisibility objVisibility = RecoverObjectVisibility(obj); if (objVisibility == ObjectVisibility.Public && Functions.isRunable(obj) && !(obj is Transaction)) { if (!isReferencedFromOutside) { listPubObjNotReferenced += Functions.linkObject(obj) + " "; } } // Por un error de GX, no se listan los SDT pues todos quedan como publicos aunque esten marcados como privados. if (objVisibility == ObjectVisibility.Private && isReferencedFromOutside && !(obj is SDT) && !(obj is Folder)) { listPirvateObjReferenced += Functions.linkObject(obj) + " "; } } string objOutsideModuleAccessPrivateTable = ""; string objUpdateOutsideModuleList = ""; string objToMove = ""; //Hago lo mismo para las tablas del modulo. IList <KBObject> tblList = (from r in Table.GetAll(kbModel) where TablesHelper.TableModule(kbModel, r) == mdl select kbModel.Objects.Get(r.Key)).ToList(); foreach (Table tbl in tblList) { string tableName = tbl.Name; ObjectVisibility visibility = TableVisibility(tbl); bool TableReferencedFromOutside = IsReferencedFromOutside(mdl, (KBObject)tbl, out objOutsideModuleAccessPrivateTable); if (TableReferencedFromOutside && (visibility == ObjectVisibility.Private)) { ListobjOutsideModuleAccessPrivateTable += objOutsideModuleAccessPrivateTable + "<BR>" + Environment.NewLine; } else if (!TableReferencedFromOutside && (visibility == ObjectVisibility.Public)) { listPubObjNotReferenced += Functions.linkObject((KBObject)tbl) + " "; } string objUpdateOutsideModuleListTable = ""; foreach (KBObject objUpdateOutsideModule in TablesHelper.ObjectsUpdateTableOutsideModule(kbModel, tbl)) { objUpdateOutsideModuleListTable += Functions.linkObject(objUpdateOutsideModule) + " "; } if (objUpdateOutsideModuleListTable != "") { objUpdateOutsideModuleList += tbl.Name + " (" + objUpdateOutsideModuleListTable + ")<BR>"; } //Veo los objetos que referencian alguna tabla desde fuera del modulo, si tienen alguna tabla de otro modulo //Si son todas de mi modulo, lo pongo en la lista de los objetos a mover a mi modulo. foreach (KBObject objreadOutsideModule in TablesHelper.ObjectsReadTableOutsideModule(tbl)) { if (ListModulesOfReferencedTables(objreadOutsideModule).Count == 1) { objToMove += Functions.linkObject(objreadOutsideModule) + "; "; } } } string[] mdlStats = new string[] { Functions.linkObject(mdl), listPubObjNotReferenced, listPirvateObjReferenced, ListobjOutsideModuleAccessPrivateTable, objUpdateOutsideModuleList, objToMove }; return(mdlStats); }
protected virtual void CollectObjectData(BaseGameObjectData baseData, ObjectVisibility visibility) { Debug.Assert(visibility != ObjectVisibility.None); baseData.ObjectID = this.ObjectID; baseData.CreationTime = this.CreationTime; baseData.CreationTick = this.CreationTick; baseData.Properties = SerializeProperties(). Where(kvp => (PropertyVisibilities.GetPropertyVisibility(kvp.Key) & visibility) != 0). Select(kvp => new KeyValuePair<PropertyID, object>(kvp.Key, kvp.Value)). ToArray(); }
internal static void ListTableInModules() { IKBService kbserv = UIServices.KB; KBModel model = kbserv.CurrentModel.GetDesignModel(); string title = "KBDoctor - List tables in modules"; IOutputService output = CommonServices.Output; output.StartSection(title); string outputFile = Functions.CreateOutputFile(kbserv, title); KBDoctorXMLWriter writer = new KBDoctorXMLWriter(outputFile, Encoding.UTF8); writer.AddHeader(title); writer.AddTableHeader(new string[] { "Name", "Description", "Visibility", "Best", "Best Module", "Modules", "Transaction", "Trn(NoGenerate)", "Referenced Modules", "Referenced" }); SelectObjectOptions selectObjectOption = new SelectObjectOptions(); selectObjectOption.MultipleSelection = true; selectObjectOption.ObjectTypes.Add(KBObjectDescriptor.Get <Module>()); foreach (KBObject module in UIServices.SelectObjectDialog.SelectObjects(selectObjectOption)) { foreach (Table t in Table.GetAll(module.Model)) { if (TablesHelper.TableModule(module.Model, t) == module) { string objNameLink = Functions.linkObject(t); output.AddLine("Processing... " + t.Name); int countAttr = 0; int countKeyAttr = 0; int widthKey = 0; int width = 0; int widthVariable = 0; int widthFixed = 0; ObjectVisibility objVisibility = TableVisibility(t); KBObject trnBest = GenexusBLServices.Tables.GetBestAssociatedTransaction(model, t.Key); Module mdlTrnBest = trnBest.Module; string trnGen = ""; string trnNoGen = ""; List <string> mdlList = new List <string>(); foreach (Transaction trn in t.AssociatedTransactions) { string trnstr = Functions.linkObject(trn) + "(" + ((trn.IsPublic) ? "Public" : "Private") + ") <br/> "; if (trn.GetPropertyValue <bool>(Properties.TRN.GenerateObject)) { trnGen += trnstr; } else { trnNoGen += trnstr; } if (!mdlList.Contains(trn.Module.Name)) { mdlList.Add(trn.Module.Name); } } IList <KBObject> objList = (from r in model.GetReferencesTo(t.Key, LinkType.UsedObject) where r.ReferenceType == ReferenceType.WeakExternal // las referencias a tablas que agrega el especificador son de este tipo //where ReferenceTypeInfo.HasUpdateAccess(r.LinkTypeInfo) select model.Objects.Get(r.From)).ToList(); IList <KBObject> objList2 = objList.Where(r => r.Module != mdlTrnBest).ToList(); string objListQNames = null; objList2.ToList().ForEach(v => objListQNames += " " + Functions.linkObject(v)); List <string> mdlReferencedList = new List <string>(); foreach (KBObject o in objList) { if (!mdlReferencedList.Contains(o.Module.Name)) { mdlReferencedList.Add(o.Module.Name); } } string mdlListstr = String.Join(" ", mdlList.ToArray()); string mdlReferencedListstr = String.Join(" ", mdlReferencedList.ToArray()); writer.AddTableData(new string[] { objNameLink, t.Description, objVisibility.ToString(), trnBest.QualifiedName.ToString(), mdlTrnBest.Name, mdlListstr, trnGen, trnNoGen, mdlReferencedListstr, objListQNames }); } } } writer.AddFooter(); writer.Close(); KBDoctorHelper.ShowKBDoctorResults(outputFile); bool success = true; output.EndSection(title, success); }
public static NodeBuilder AddLineToNode(Document document, Point3D point1, Point3D point2, ObjectVisibility visibility = ObjectVisibility.ToBeDisplayed) { var sketchCreator = new SketchCreator(document); var firstPointBuilder = sketchCreator.GetPoint(point1); var secondPointBuilder = sketchCreator.GetPoint(point2); firstPointBuilder.Visibility = visibility; secondPointBuilder.Visibility = visibility; var firstPoint = firstPointBuilder.Node; var secondPoint = secondPointBuilder.Node; var builder = sketchCreator.CreateBuilder(FunctionNames.LineTwoPoints); builder[0].Reference = firstPoint; builder[1].Reference = secondPoint; builder.ExecuteFunction(); return(builder); }
// Use this for initialization void Start () { if (visibility == null){ visibility = GetComponent<ObjectVisibility>(); } }