/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { Plane plane = new Plane(); Mesh mesh = null; string viewName = ""; DA.GetData("Mesh", ref mesh); DA.GetData("Plane", ref plane); RhinoViewport rhinoView; Animation.Frame frameComponent; if (DA.GetData("ViewName", ref viewName)) { foreach (RhinoView view in Rhino.RhinoDoc.ActiveDoc.Views) { if (view.ActiveViewport.Name == viewName) { rhinoView = view.ActiveViewport; DA.SetDataList("OutLine", mesh.GetOutlines(new ViewportInfo(rhinoView), plane)); break; } } } else if (BasicFunction.ConnectToFrame(this, out frameComponent)) { rhinoView = frameComponent.RhinoView.ActiveViewport; DA.SetDataList("OutLine", mesh.GetOutlines(new ViewportInfo(rhinoView), plane)); } else { this.AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Input Frame and ViewName require an input!"); } }
public void Add3DGraph(string name, BasicFunction funcX, VectorFunc funcY, string xTitle, string yTitle) { GraphUnderlying graphU = new GraphUnderlying(xTitle, yTitle); graphU.AddTimeline(new Timeline("x " + name, Colors.Red)); graphU.AddTimeline(new Timeline("y " + name, Colors.Green)); graphU.AddTimeline(new Timeline("z " + name, Colors.Blue)); BasicFunction xVec = () => funcY().X; BasicFunction yVec = () => funcY().Y; BasicFunction zVec = () => funcY().Z; var list = new List <BasicFunctionPair>(); list.Add(new BasicFunctionPair() { XFunc = funcX, YFunc = xVec }); list.Add(new BasicFunctionPair() { XFunc = funcX, YFunc = yVec }); list.Add(new BasicFunctionPair() { XFunc = funcX, YFunc = zVec }); AddGraph(graphU, list); }
/// <summary> /// 显示主功能 /// </summary> /// <param name="_func"></param> private void ShowFunction(BasicFunction _func) { switch (_func) { case BasicFunction.Session: openTable(_func.ToString(), "会话", userID); break; case BasicFunction.Assistant: openTable(_func.ToString(), "个人秘书", userID); break; case BasicFunction.SocialNet: openTable(_func.ToString(), "社交网络", userID); break; case BasicFunction.Market: openTable(_func.ToString(), "电子商城", userID); break; case BasicFunction.News: openTable(_func.ToString(), "新闻", userID); break; } }
public IBasicFunctionRegistrator Register(BasicFunction basicFunction) { var defaultWithViewFunction = GetDefaultFunctionsWithView(); var result = GetModuleFunctionContainer(); if (defaultWithViewFunction.Contains(basicFunction) && result.Functions.All(o => o != BasicFunction.View.ToString())) { result.Functions.Add(BasicFunction.View.ToString()); } if (result.Functions.All(o => o.ToLower() != basicFunction.ToString().ToLower())) { switch (basicFunction) { case BasicFunction.Delete: result.Functions.Add("DeleteItems"); break; case BasicFunction.Toggle: result.Functions.Add("ToggleStatus"); break; default: result.Functions.Add(basicFunction.ToString()); break; } } return(this); }
// TODO prompt // Destorys the ParentGO of the given BasicFunction after a prompt public void ClosePrompt(BasicFunction bf) { Debug.Log("Prompt -"); bool prompt = true; if (prompt = true) { Close(bf); } }
public void AddSingleGraph(string name, Color color, BasicFunction xFunc, BasicFunction yFunc, string xAxis, string yAxis) { var info = new TimelineInfo(new TimelinePrototype(name, color), new BasicFunctionPair(xFunc, yFunc)); AddGraph(new List <TimelineInfo>() { info }, xAxis, yAxis); }
public void AddFunction(string name, BasicFunction function) { if (!funcs.ContainsKey(name)) { funcs.Add(name, function); } else { funcs[name] = function; } }
public void Execute(BasicFunction function, IEnumerable <DataCell> input_data, DataCell output, CommandContext command_context = null) { if (_availableExecutionServices.ContainsKey(typeof(BasicExecutionService))) { _availableExecutionServices[typeof(BasicExecutionService)].Execute(function, input_data, output, command_context); } else { throw new Exception(String.Format("Исполнитель базовых функций не доступен.")); } }
public override void Awake() { base.Awake(); // Set up BasicFunctions held hoverBF = null; currentBF = null; heldBF = null; lastClickedBF = null; lastHeldBF = null; mainCam = Camera.main; }
/// <summary> /// Возвращает модель исполнения базовой функции. /// </summary> /// <param name="basic_function"></param> /// <returns></returns> public static BasicFunctionModel GetModel(this BasicFunction basic_function) { var name = ((BasicFunctionHeader)basic_function.Header).Name; if (BasicFunctionModel.AllMethods.ContainsKey(name)) { return(BasicFunctionModel.AllMethods[name]); } throw new Exception($"Отсутствует реализация метода с названием '{name}'"); }
public void InvokeClick() { if (hoverBF && hoverBF.Active) { currentBF = hoverBF; Debug.Log("we hit something captain!"); currentBF.Press?.Invoke(); lastClickedBF = currentBF; heldBF = currentBF; } }
public void InvokeRelease() { if (currentBF && hoverBF.Active) { Debug.Log("we released something captain!"); currentBF.Release?.Invoke(); } if (hoverBF && hoverBF.Active) { lastHeldBF = heldBF; heldBF = null; } }
// Make the lastBF the currentBF and update currentBF public void UpdateCurrentBasicFunction() { prevHoverBF = hoverBF; hoverBF = null; if (hit.collider) { hoverBF = hit.collider.GetComponent <BasicFunction>(); } else { currentBF = null; } }
public void Add3DGraph(string name, BasicFunction funcX, VectorFunc funcY, string xAxis, string yAxis) { var xVec = new TimelineInfo(new TimelinePrototype("x " + name, Color.Red), new BasicFunctionPair(funcX, () => funcY().X)); var yVec = new TimelineInfo(new TimelinePrototype("y " + name, Color.Green), new BasicFunctionPair(funcX, () => funcY().Y)); var zVec = new TimelineInfo(new TimelinePrototype("z " + name, Color.Blue), new BasicFunctionPair(funcX, () => funcY().Z)); AddGraph(new List <TimelineInfo> { xVec, yVec, zVec }, xAxis, yAxis); }
public void AddText(string title, Color color, BasicFunction textFunc) { var text = new UpdatingText() { Title = title, Color = color }; void function(DataSource ds) { ds.AddData(textFunc()); } updatingCollection.AddContainer(new UpdatingContainer(text, function)); updatingFunctions.AddFunction(function); Graphs.AddGraph(text); }
public void AddSingleGraph(string name, Color color, BasicFunction xFunc, BasicFunction yFunc, string xAxis, string yAxis) { var gu = new GraphUnderlying(xAxis, yAxis); var timeline = new Timeline(name, color); gu.AddTimeline(timeline); Graph graph = new Graph(gu); void function(DataSource ds) { ds.AddData(xFunc()); ds.AddData(yFunc()); } updatingCollection.AddContainer(new UpdatingContainer(gu, function)); updatingFunctions.AddFunction(function); Graphs.AddGraph(graph); }
public bool UserHasAccess(BasicFunction basicFunction, string moduleNameNoWhitespace, int userId) { bool hasAccess = false; if (moduleNameNoWhitespace != null && moduleNameNoWhitespace.Trim() != string.Empty) { string functionName = string.Format("{0}{1}", basicFunction.ToString(), moduleNameNoWhitespace); hasAccess = (from a in UnitOfWork.Repository <UserGroupMap>().GetAll join b in UnitOfWork.Repository <UserGroupFunction>().GetAll on a.UserGroupId equals b.UserGroupId join c in UnitOfWork.Repository <CentralFunction>().GetAll on b.CentralFunctionId equals c.CentralFunctionId where c.FunctionName == functionName & a.UserId == userId select c.FunctionName) .Any(); } return(hasAccess); }
public BasicFunctionPair(BasicFunction xFunc, BasicFunction yFunc) { XFunc = xFunc; YFunc = yFunc; }
public void Run() { // Set Console Window Height to fit all text within screen Console.WindowHeight = 30; // Assign exit variable as an int int ExitApp = 0; do { // INTRO //===================================================================================================== // Call Intro method from basic functions class and display intro message // Call newScreen method to refresh screen BasicFunction BF = new BasicFunction(); BF.Intro(); BF.newScreen(); // MAIN FUNCTION //====================================================================================================== // Assign a temp local variable string sentenceNoWhiteSpace; TOP: // starting point for when the loop is broken // Take user input and assign user input to senetce. Console.WriteLine("\nPlease enter some text . . .\n"); sentence = Console.ReadLine(); // Conduct a Presence Check to prevent blank field if (sentence.Length == 0) { Console.Clear(); // Display Error Message // Messagebox.("ERROR: The field has been left blank. Enter some text to continue . . .\n"); MessageBox.Show("ERROR: The field has been left blank. Enter some text to continue . . ."); // Break loop and go to starting point goto TOP; } Console.Clear(); Console.WriteLine(sentence); // Create a new string & Remove whitespaces using Regular Expressions sentenceNoWhiteSpace = Regex.Replace(sentence, @" ", ""); // Convert all leters to lowercase/Convert to a char array char[] charArray = sentenceNoWhiteSpace.ToLower().ToCharArray(); // Sort array into alphabetical order Array.Sort(charArray); // Create Dictionary which stores each character and the ammount of times it occurs within the sentence. Dictionary<char, int> counter = new Dictionary<char, int>(); // Create a temporary variable. int temp = 0; // Loop through each character in the array foreach (var letter in charArray) { //Get value associated with specified key if (counter.TryGetValue(letter, out temp)) { counter[letter] += 1; } else { counter.Add(letter, 1); } } // End Foreach Loop // Retrive data from dictionary and display how many times each character has occured. Console.WriteLine("\n================================"); foreach (KeyValuePair<char, int> letter in counter) { Console.WriteLine(string.Format("\nTotal Number of: {0} = {1}", letter.Key.ToString(), letter.Value)); } //End Foreach Loop Console.WriteLine("\n================================"); // Refresh Screen BF.newScreen(); // Display Sentence string Console.WriteLine(sentence); // Display all basic calculations of sentence. WordCount.DisplayBasicSentenceCalculations(); //Refresh Screen BF.newScreen(); // ADDITIONAL FUNCTONALITY //================================================================================================================= // Test for any word combinations and display them out to user. WordCount.DisplayWord(); // OUTRO //================================================================================================================== //Refresh Screen BF.newScreen(); // Prompt User to RESART application or EXIT application BF.GoodBye(); // Pass User input as a int ExitApp = int.Parse(Console.ReadLine()); Console.Clear(); }// End Do Loop // Terminate Application while (ExitApp != NO); }
// Destorys the ParentGO of the given BasicFunction public void Close(BasicFunction bf) { Debug.Log("Close Basic Function"); GameObject.Destroy(bf.ParentGO); }