Esempio n. 1
0
        protected void ResetPersistentData(IEnumerable <IGH_Goo> list, string name)
        {
            RecordPersistentDataEvent(name);

            PersistentData.Clear();
            if (list is object)
            {
                PersistentData.AppendRange(list, new GH_Path(0));
            }

            OnObjectChanged(GH_ObjectEventType.PersistentData);

            base.ClearData();
            ExpireDownStreamObjects();
            OnSolutionExpired(false);

            Phase = GH_SolutionPhase.Collecting;
            AddVolatileDataTree(PersistentData.Duplicate());
            PostProcessVolatileData();
            Phase = GH_SolutionPhase.Collected;

            if (OnPingDocument() is GH_Document doc)
            {
                doc.ClearReferenceTable();
                doc.NewSolution(false);
            }
        }
Esempio n. 2
0
        private void ListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (sender is ListBox listBox)
            {
                RecordUndoEvent($"Set: {NickName}");
                PersistentData.Clear();
                PersistentData.AppendRange(listBox.SelectedItems.OfType <Types.Level>());

                ExpireSolution(true);
            }
        }
Esempio n. 3
0
    private void CheckPersistentData()
    {
        Debug.Log("CHECKING PERSISTENT DATA");
        Debug.Log(dataPath);
        Debug.Log(previousGamePath);
        Debug.Log(persistentData.GameId);
        if (persistentData.GameId == null || persistentData.GameId.Equals(""))
        {
            persistentData.Clear();
            SavePersistentData();
            return;
        }
        string state = Rest.GetGameState(persistentData.GameId);

        if (state.Equals("STAGED") || state.Equals("RUNNING"))
        {
            //Show Reconnecting popup
            if (ReconnectPanel != null)
            {
                ReconnectPanel.SetActive(true);
                reconnectCancelled = false;
            }
            else
            {
                Debug.Log("NO RECONNECTING PANEL FOUND");
                reconnectCancelled = true;                //todo this shouldn't happen
            }

            //hot join game now
            ClientToken  = persistentData.ClientToken;
            GameId       = persistentData.GameId;
            PasswordUsed = persistentData.PasswordUsed;

            StartCoroutine(HotJoin(state));
        }
        else
        {
            persistentData.Clear();
            SavePersistentData();
        }
    }
Esempio n. 4
0
        private void Menu_DestroyPersistentData(object sender, EventArgs e)
        {
            if (PersistentDataCount == 0)
            {
                return;
            }

            RecordPersistentDataEvent("Clear selection");
            PersistentData.Clear();
            OnObjectChanged(GH_ObjectEventType.PersistentData);

            OnPingDocument()?.ClearReferenceTable();
            ExpireSolution(true);
        }
Esempio n. 5
0
        protected void Menu_SelectAllClicked(object sender, EventArgs e)
        {
            RecordUndoEvent("Select all");

            foreach (var item in ListItems)
            {
                item.Selected = true;
            }

            PersistentData.Clear();
            PersistentData.AppendRange(SelectedItems.Select(x => x.Value), new GH_Path(0));
            OnObjectChanged(GH_ObjectEventType.PersistentData);

            ExpireSolution(true);
        }
Esempio n. 6
0
        private void ListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (sender is ListBox listBox)
            {
                if (listBox.SelectedIndex != -1)
                {
                    if (listBox.Items[listBox.SelectedIndex] is IGH_GooProxy value)
                    {
                        RecordUndoEvent($"Set: {value}");
                        PersistentData.Clear();
                        PersistentData.Append(value.ProxyOwner as Types.ParameterKey);
                    }
                }

                ExpireSolution(true);
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Select a new Criter.
        /// </summary>
        /// <param name="source">Criter: Collates nesting Criterion constraints.</param>
        private void SetNewCriter(Criter source)
        {
            try
            {
                RecordPersistentDataEvent("Set Criterion");
                PersistentData.Clear();

                if (source != null)
                {
                    PersistentData.Append(new CriterionGoo(source), new GH_Path(0));
                }
            }
            finally
            {
                ExpireSolution(true);
            }
        }
Esempio n. 8
0
        private void ElementTypesBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (sender is ListBox listBox)
            {
                if (listBox.SelectedIndex != -1)
                {
                    if (listBox.Items[listBox.SelectedIndex] is T value)
                    {
                        RecordUndoEvent($"Set: {value}");
                        PersistentData.Clear();
                        PersistentData.Append(value);
                    }
                }

                ExpireSolution(true);
            }
        }
        /// <summary>
        /// Select a new Orientation.
        /// </summary>
        /// <param name="orientation">COrientation: Collates nesting orientation constraints.</param>
        public void SetNewOrientation(COrientation orientation)
        {
            try
            {
                RecordPersistentDataEvent("Set orientation");
                PersistentData.Clear();

                if (orientation != null)
                {
                    PersistentData.Append(new OrientationGoo(orientation), new GH_Path(0));
                }
            }
            finally
            {
                ExpireSolution(true);
            }
        }
Esempio n. 10
0
        private void Menu_ClearPersistentData(object sender, EventArgs e)
        {
            if (PersistentDataCount > 0)
            {
                foreach (INXDisplayableObject item in PersistentData)
                {
                    if (item.Highlight)
                    {
                        item.Highlight = false;
                    }
                }

                PersistentData.Clear();

                OnPingDocument()?.ClearReferenceTable();

                ExpireSolution(true);
            }
        }
        private void MaterialItemOnClick(object sender, EventArgs eventArgs)
        {
            ToolStripMenuItem item = sender as ToolStripMenuItem;

            if (item == null)
            {
                return;
            }

            string code = (string)item.Tag;

            if (IsMaterialSelected(code))
            {
                return;
            }

            RecordPersistentDataEvent("Set material: " + item.Name);
            PersistentData.Clear();
            PersistentData.Append(new GH_String(code));
            ExpireSolution(true);
        }
Esempio n. 12
0
 private void SetDefaultHandler(object sender, EventArgs e)
 {
     PersistentData.Clear();
     PersistentData.Append(ABBTool.Default, new GH_Path(0));
     ExpireSolution(true);
 }
Esempio n. 13
0
 public void MainMenuConfirmConfirm()
 {
     PersistentData.Clear();
     SceneManager.LoadScene("MainMenu", LoadSceneMode.Single);
 }
Esempio n. 14
0
 public void ReturnToMainMenu()
 {
     PersistentData.Clear();
     SceneManager.LoadScene("MainMenu", LoadSceneMode.Single);
 }
Esempio n. 15
0
 private void SetDefaultHandler(object sender, EventArgs e)
 {
     PersistentData.Clear();
     PersistentData.Append(new GH_Integer((int)MotionType.Linear), new GH_Path(0));
     ExpireSolution(true);
 }