protected bool SwitchToNormal(List <UpdateObject> updateList, List <RenderObject> renderList) { bool result = false; if (State == States.Inactive) { updateList.Add(updateObj); //updateObj.Activate(); renderList.Add(renderObj); renderObj.Activate(); } else if (State == States.Hot) { updateObj.Deactivate(); } renderObj.State = ControlRenderObj.idStateNormal; AffixLineNumberToCurrentState(); return(result); }
protected bool SwitchToNormal(List <UpdateObject> updateList, List <RenderObject> renderList) { bool result = false; if (state == States.Inactive) { // Don't keep adding the same object to the list! if (!updateList.Contains(updateObj)) { updateList.Add(updateObj); } //updateObj.Activate(); renderList.Add(renderPanel); SwitchRenderStateTo(ControlRenderObj.idStateNormal); renderPanel.Activate(); } else if (state == States.Hot) { updateObj.Deactivate(); SwitchRenderStateTo(ControlRenderObj.idStateNormal); } return(result); }
public override void Activate() { renderObj.Activate(); visable = true; }
protected void CreateCards(string idState) { // create handle // ReflexHandle reflexHandle = new ReflexHandle(this, reflex, controls); ITransform transformHandle = reflexHandle as ITransform; Matrix anchor; renderPanel.GetPositionTransform(idRowHandleAnchor, out anchor); transformHandle.Local.Matrix = anchor; transformHandle.Compose(); listControls.Add(reflexHandle); Matrix chain; renderPanel.GetPositionTransform(idLeftClauseAnchor, out chain); Matrix clauseOffset = Matrix.Identity; { Matrix leftClause; Matrix rightClause; renderPanel.GetPositionTransform(idLeftClauseAnchor, out leftClause); renderPanel.GetPositionTransform(idRightClauseAnchor, out rightClause); clauseOffset.Translation = rightClause.Translation - leftClause.Translation; } Matrix local; // create the begining of the when clause trays // chain = AddClauseLeft(this.listWhenClause, chain, idWhenClause, idState); // create cards for when clause // //Matrix shiftOutOfSocket = Matrix.CreateTranslation(new Vector3(0.0f, 0.0f, 0.05f)); CardSpace.CardType plusType = CardSpace.CardType.Sensor; ProgrammingElement plusElement = CardSpace.Cards.NullSensor; if (reflex.Sensor != null) { chain = AddClauseRepeat(this.listWhenClause, out local, chain, idWhenClause, idState); AddCard(local, reflex.Sensor, CardSpace.CardType.Sensor, this.listWhenClause[this.listWhenClause.Count - 1] as ControlRenderObj); plusType = CardSpace.CardType.Filter; plusElement = CardSpace.Cards.NullFilter; } if (reflex.RawFilters != null) { for (int iFilter = 0; iFilter < reflex.RawFilters.Count; iFilter++) { Filter filter = reflex.RawFilters[iFilter] as Filter; chain = AddClauseRepeat(this.listWhenClause, out local, chain, idWhenClause, idState); AddCard(local, filter, CardSpace.CardType.Filter, this.listWhenClause[this.listWhenClause.Count - 1] as ControlRenderObj); } } // create the end of the when clause chain = AddClauseRight(this.listWhenClause, out local, chain, idWhenClause, idState); if (ReflexCard.HasSelectableElements(reflex, plusType)) { // add the ever present + with context AddCard(local, plusElement, plusType, this.listWhenClause[this.listWhenClause.Count - 1] as ControlRenderObj); } // adjust for next clause chain *= clauseOffset; // create the begining of the do clause trays // chain = AddClauseLeft(this.listDoClause, chain, idDoClause, idState); plusType = CardSpace.CardType.Actuator; plusElement = CardSpace.Cards.NullActuator; if (reflex.Actuator != null) { chain = AddClauseRepeat(this.listDoClause, out local, chain, idDoClause, idState); AddCard(local, reflex.Actuator, CardSpace.CardType.Actuator, this.listDoClause[this.listDoClause.Count - 1] as ControlRenderObj); // Specify Selector type here, since selector menu will pull in modifiers as well. plusType = CardSpace.CardType.Selector; plusElement = CardSpace.Cards.NullSelector; } if (reflex.Selector != null && !reflex.Selector.hiddenDefault) { chain = AddClauseRepeat(this.listDoClause, out local, chain, idDoClause, idState); AddCard(local, reflex.Selector, CardSpace.CardType.Selector, this.listDoClause[this.listDoClause.Count - 1] as ControlRenderObj); // Specify Selector type here, since selector menu will pull in modifiers as well. plusType = CardSpace.CardType.Selector; plusElement = CardSpace.Cards.NullSelector; } if (reflex.Modifiers != null) { for (int iModifier = 0; iModifier < reflex.Modifiers.Count; iModifier++) { Modifier modifier = reflex.Modifiers[iModifier] as Modifier; chain = AddClauseRepeat(this.listDoClause, out local, chain, idDoClause, idState); AddCard(local, modifier, CardSpace.CardType.Modifier, this.listDoClause[this.listDoClause.Count - 1] as ControlRenderObj); } } // create the end of the do clause chain = AddClauseRight(this.listDoClause, out local, chain, idDoClause, idState); CardSpace.CardType cardTypeMask; if (reflex.Actuator == null) { cardTypeMask = CardSpace.CardType.Actuator; } else if (reflex.Selector == null && reflex.Modifiers.Count == 0) { cardTypeMask = CardSpace.CardType.Selector | CardSpace.CardType.Modifier; } else if (reflex.Selector == null && reflex.Modifiers.Count == 1 && this.ActiveCard > 0 && this.ActiveCard < this.listControls.Count && this.listControls[this.ActiveCard] is ReflexCard) { cardTypeMask = CardSpace.CardType.Modifier; if ((this.listControls[this.ActiveCard] as ReflexCard).Card is Modifier) { cardTypeMask |= CardSpace.CardType.Selector; } } else { cardTypeMask = CardSpace.CardType.Modifier; } if (ReflexCard.HasSelectableElements(reflex, cardTypeMask)) { // HACK HACK If use has DO Move Freeze this will still add a '+' to the // end because it thinks that a selector is still a possibility. The // proper solution is to either make Freeze a selector or, better yet, // do away with selectors altogether. if (reflex.modifierUpids.Length == 0 || reflex.modifierUpids[0] != "modifier.constraint.immobile") { // add the + with context AddCard(local, plusElement, plusType, this.listDoClause[this.listDoClause.Count - 1] as ControlRenderObj); } } for (int indexClause = 0; indexClause < this.listWhenClause.Count; indexClause++) { ControlRenderObj renderObj = this.listWhenClause[indexClause] as ControlRenderObj; renderObj.Activate(); renderPanel.renderList.Add(renderObj); } for (int indexClause = 0; indexClause < this.listDoClause.Count; indexClause++) { ControlRenderObj renderObj = this.listDoClause[indexClause] as ControlRenderObj; renderObj.Activate(); renderPanel.renderList.Add(renderObj); } for (int indexCard = 0; indexCard < this.listControls.Count; indexCard++) { GameObject gameObjCard = this.listControls[indexCard] as GameObject; gameObjCard.Activate(); gameObjCard.Refresh(updateObjEditCards.updateList, renderPanel.renderList); } }