public EditBehavior DuplicateBehavior(EditBehavior behavior) { var newBehavior = behavior.Duplicate(); behaviors.Add(newBehavior); return(newBehavior); }
private void LoadContext() { using (var conn = new SqlConnection(DAL.ConnectionString)) { conn.Open(); var parameter = new SqlParameter("@ContextID", ContextId); var command = new SqlCommand("spCPCmmGetContext", conn); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(parameter); var reader = command.ExecuteReader(); if (reader.Read()) { Caption = (string)reader["Caption"]; EntityKey = (int?)reader["EntityKey"]; EntityName = (string)reader["EntityName"]; SPGetOwnerName = (string)reader["spGetOwnerName"]; GroupByType = (short)reader["GroupByType"]; RowHeight = (int)reader["RowHeight"]; AllowRowSizing = (short)reader["AllowRowSizing"]; EditBehavior = (EditBehavior)reader["EditBehavior"]; } } }
public void DeleteBehavior(EditBehavior behavior) { foreach (var preset in presets) { preset.DeleteBehavior(behavior); } behaviors.Remove(behavior); }
void Hide(bool result, EditBehavior behavior) { foreach (var uibehavior in behaviors) { DestroyBehaviorToken(uibehavior); } behaviors.Clear(); gameObject.SetActive(false); closeAction?.Invoke(result, behavior); closeAction = null; }
UIBehaviorPickerBehaviorToken CreateBehaviorToken(EditBehavior behavior) { // Create the gameObject var ret = GameObject.Instantiate <UIBehaviorPickerBehaviorToken>(behaviorTokenPrefab, contentRoot.transform); // When we click on the pattern main button, go to the edit page ret.onClick.AddListener(() => Hide(true, ret.editBehavior)); // Initialize it ret.Setup(behavior); return(ret); }
public void Setup(EditBehavior behavior) { this.editBehavior = behavior; this.dieRenderer = DiceRendererManager.Instance.CreateDiceRenderer(editBehavior.defaultPreviewSettings.design); if (dieRenderer != null) { dieRenderer.SetAuto(true); dieRenderImage.texture = dieRenderer.renderTexture; dieRenderer.SetAnimations(this.editBehavior.CollectAnimations()); dieRenderer.Play(true); } nameText.text = behavior.name; descriptionText.text = behavior.description; SetSelected(false); }
UIHomeBehaviorToken CreateBehaviorToken(EditBehavior behavior) { // Create the gameObject var ret = GameObject.Instantiate <UIHomeBehaviorToken>(behaviorTokenPrefab, Vector3.zero, Quaternion.identity, behaviorsRoot.transform); // When we click on the pattern main button, go to the edit page ret.onClick.AddListener(() => { ActivateBehavior(behavior); }); // Initialize it ret.Setup(behavior); return(ret); }
public void Setup(EditBehavior behavior) { this.editBehavior = behavior; this.dieRenderer = DiceRendererManager.Instance.CreateDiceRenderer(behavior.defaultPreviewSettings.design); if (dieRenderer != null) { behaviorRenderImage.texture = dieRenderer.renderTexture; } behaviorNameText.text = behavior.name; dieRenderer.SetAuto(true); dieRenderer.SetAnimations(this.editBehavior.CollectAnimations()); dieRenderer.Play(true); RefreshState(); }
public void Setup(EditBehavior bh) { this.editBehavior = bh; this.dieRenderer = DiceRendererManager.Instance.CreateDiceRenderer(bh.defaultPreviewSettings.design); if (dieRenderer != null) { behaviorRenderImage.texture = dieRenderer.renderTexture; } behaviorNameText.text = bh.name; behaviorDescriptionText.text = bh.description; dieRenderer.SetAuto(true); dieRenderer.SetAnimations(this.editBehavior.CollectAnimations()); dieRenderer.Play(true); Expand(false); }
void Setup(EditBehavior behavior) { editBehavior = behavior; this.dieRenderer = DiceRendererManager.Instance.CreateDiceRenderer(editBehavior.defaultPreviewSettings.design, 300); if (dieRenderer != null) { previewImage.texture = dieRenderer.renderTexture; } // Generate a title for the page descriptionText.text = editBehavior.description; RefreshView(); dieRenderer.SetAuto(true); dieRenderer.SetAnimations(this.editBehavior.CollectAnimations()); dieRenderer.Play(true); }
/// <summary> /// Invoke the die picker /// </sumary> public void Show(string title, EditBehavior previousBehavior, System.Action <bool, EditBehavior> closeAction) { if (isShown) { Debug.LogWarning("Previous Behavior picker still active"); ForceHide(); } foreach (var behavior in AppDataSet.Instance.behaviors) { // New pattern var newBehaviorUI = CreateBehaviorToken(behavior); newBehaviorUI.SetSelected(behavior == previousBehavior); behaviors.Add(newBehaviorUI); } gameObject.SetActive(true); currentBehavior = previousBehavior; titleText.text = title; this.closeAction = closeAction; }
public static AppDataSet CreateTestDataSet() { AppDataSet ret = new AppDataSet(); // We only save the dice that we have indicated to be in the pool // (i.e. ignore dice that are 'new' and we didn't connect to) var die0 = new EditDie() { name = "Die 000", deviceId = 0x123456789ABCDEF0, faceCount = 20, designAndColor = DesignAndColor.V3_Orange }; ret.dice.Add(die0); var die1 = new EditDie() { name = "Die 001", deviceId = 0xABCDEF0123456789, faceCount = 20, designAndColor = DesignAndColor.V5_Black }; ret.dice.Add(die1); var die2 = new EditDie() { name = "Die 002", deviceId = 0xCDEF0123456789AB, faceCount = 20, designAndColor = DesignAndColor.V5_Grey }; ret.dice.Add(die2); var die3 = new EditDie() { name = "Die 003", deviceId = 0xEF0123456789ABCD, faceCount = 20, designAndColor = DesignAndColor.V5_Gold }; ret.dice.Add(die3); EditAnimationSimple simpleAnim = new EditAnimationSimple(); simpleAnim.duration = 1.0f; simpleAnim.color = EditColor.MakeRGB(Color.blue); simpleAnim.faces = 0b11111111111111111111; simpleAnim.name = "Simple Anim 1"; ret.animations.Add(simpleAnim); EditBehavior behavior = new EditBehavior(); behavior.rules.Add(new EditRule() { condition = new EditConditionRolling(), actions = new List <EditAction> () { new EditActionPlayAnimation() { animation = simpleAnim, faceIndex = 0, loopCount = 1 } } }); behavior.rules.Add(new EditRule() { condition = new EditConditionFaceCompare() { faceIndex = 19, flags = ConditionFaceCompare_Flags.Equal }, actions = new List <EditAction> () { new EditActionPlayAnimation() { animation = simpleAnim, faceIndex = 19, loopCount = 1 } } }); behavior.rules.Add(new EditRule() { condition = new EditConditionFaceCompare() { faceIndex = 0, flags = ConditionFaceCompare_Flags.Less | ConditionFaceCompare_Flags.Equal | ConditionFaceCompare_Flags.Greater }, actions = new List <EditAction> () { new EditActionPlayAnimation() { animation = simpleAnim, faceIndex = 2, loopCount = 1 } } }); ret.behaviors.Add(behavior); ret.presets.Add(new EditPreset() { name = "Preset 0", dieAssignments = new List <EditDieAssignment>() { new EditDieAssignment() { die = die0, behavior = behavior }, new EditDieAssignment() { die = die1, behavior = behavior } } }); return(ret); }