Exemplo n.º 1
0
        private void FunctionsSetting()
        {
            FunctionsTabs = new ObservableCollection <TabItem>();

            foreach (Functions functions in TableFunctions.QueryFunctions())
            {
                TabItem fTabItem = new TabItem
                {
                    Header = functions.Function_Title,
                    Uid    = functions.Function_ID.ToString()
                };

                switch (fTabItem.Uid)
                {
                case "1":
                    functionList = new FunctionList(Agencys, Patients, DisplayImageInfo);
                    functionList.ReturnValueCallback += new FunctionList.ReturnValueDelegate(RegistrationSetting);
                    functionList.ReturnRenewCallback += new FunctionList.ReturnRenewDelegate(RenewImageSource);
                    break;

                case "2":
                    functionTemplate = new FunctionTemplate(Agencys, Patients, DisplayImageInfo);
                    functionTemplate.ReturnValueCallback += new FunctionTemplate.ReturnValueDelegate(RenewUsercontrol);
                    break;
                }

                FunctionsTabs.Add(fTabItem);

                if (functions.Function_ID == Agencys.Function_ID)
                {
                    SelectedTabItem = fTabItem;
                }
            }
        }
Exemplo n.º 2
0
        public int SaveRows(DbTransaction pTran, FunctionList FunctionList, bool CreateTransaction)
        {
            int           intRows   = 0;
            DbTransaction objTran   = pTran;
            Exception     exception = null;

            try
            {
                if (pTran == null && CreateTransaction == true)
                {
                    objTran = FunctionData.CreateTransaction();
                }
                intRows = FunctionData.SaveRows(objTran, FunctionList);
                if (pTran == null && objTran != null && CreateTransaction == true)
                {
                    FunctionData.CommitTransaction(objTran, true);
                    objTran = null;
                }
            }
            catch (Exception EX)
            {
                exception = EX;
                if (pTran == null && objTran != null && CreateTransaction == true)
                {
                    FunctionData.RollbackTransaction(objTran, true);
                    objTran = null;
                }
            }
            finally
            {
            }
            return(intRows);
        }
Exemplo n.º 3
0
        private List <Function> fillFunctionList()
        {
            FunctionBusiness _FunctionBusiness = new FunctionBusiness();
            FunctionList     _FunctionList     = _FunctionBusiness.SelectRows(null, null, null);

            return(_FunctionList);
        }
    private IEnumerator ExecuteFunctions(FunctionList funcs, MonoBehaviour coroutineRunner)
    {
        float timeStarted = Time.timeSinceLevelLoad;

        if (funcs == null)
        {
            FunctionsFinished = true;
            yield break;
        }

        funcs.Sort();

        foreach (var nodeScriptLine in funcs.Functions)
        {
            var timePassed = TimePassed(timeStarted);

            while (timePassed < nodeScriptLine.TimeSec)
            {
                yield return(null);

                timePassed = TimePassed(timeStarted);
            }

            timePassed = TimePassed(timeStarted);
            if (SettingsHolder.Instance.Settings.LogDebugMessageInfo)
            {
                Debug.Log($"Node Function: {nodeScriptLine.Function?.GetType().FullName} at {timePassed}");
            }
            nodeScriptLine.Function?.RaiseEvent(coroutineRunner);
        }

        FunctionsFinished = true;
        functionDuration  = 0;
    }
    private IEnumerator InvokeFunctionsAndPlayAudioCoroutine(string name,
                                                             AudioClip clip,
                                                             FunctionList funcs,
                                                             Action onFinished,
                                                             MonoBehaviour coroutineRunner)
    {
        FunctionsFinished = false;
        AudioFinished     = false;
        invokedTime       = now;
        functionDuration  = funcs?.Duration ?? 0;

        if (clip == null)
        {
            Debug.LogWarning($"No audioClip on data of {name}");
            AudioFinished = true;
        }
        else
        {
            AudioManager.Instance.PlayClip(
                clip,
                OnAudioFinished,
                SettingsHolder.Instance.Settings.AllowInputFasterInSeconds);
        }

        coroutineRunner.StartCoroutine(ExecuteFunctions(funcs, coroutineRunner));

        while (!AudioFinished)
        {
            yield return(null);
        }

        onFinished?.Invoke();
    }
    public IEnumerator InvokeFunctionsCoroutine(FunctionList funcs, Action onFinished, MonoBehaviour coroutineRunner)
    {
        FunctionsFinished = false;

        yield return(ExecuteFunctions(funcs, coroutineRunner));

        onFinished?.Invoke();
    }
Exemplo n.º 7
0
        public void visitFunctionList(FunctionList fl)
        {
            GraphNode functionList = new GraphNode(getNewId(), NodeType.FunctionList, "Function List");

            _graph.add(functionList);
            addASTEdge(functionList, "");

            visitChildren(functionList, fl);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Initializes PacketHandler class
        /// </summary>
        static PacketHandler()
        {
            s_opcodeMap = new FunctionList[256 * 256];
            for (int i = 0; i < 256 * 256; i++)
            {
                s_opcodeMap[i] = new FunctionList();
            }

            Game.OnProcessPacket += Game_OnProcessPacket;
        }
Exemplo n.º 9
0
        public void AddFunction(Function function)
        {
            Functions[function.Name] = function;
            FunctionList.Add(function);

            if (function.Name.Text == "Go")
            {
                EntryPoint = function;
            }
        }
Exemplo n.º 10
0
        public Rv C_GetFunctionList(ref FunctionList functionList)
        {
            if (App == null)
            {
                return(Rv.DEVICE_ERROR);
            }

            App.FunctionList = functionList;

            return(Rv.OK);
        }
Exemplo n.º 11
0
        public void AddFunction(Function function)
        {
            function.Parent          = this;
            Functions[function.Name] = function;
            FunctionList.Add(function);

            if (function.Name == "Go")
            {
                EntryPoint = function;
            }
        }
Exemplo n.º 12
0
        public override ICopySupportObject Clone()
        {
            var o = new Stuff()
            {
                Number = Number, Value = Value
            };

            FunctionList.ForEach(v => o.FunctionList.Add(v.Clone() as IStuffFunction));
            LoadData(o);
            return(o);
        }
Exemplo n.º 13
0
        public Function AddFunction(string name, string functionName = "")
        {
            var item = new Function(GenDataBase)
            {
                GenObject    = ((GenObject)GenObject).CreateGenObject("Function"),
                Name         = name,
                FunctionName = functionName
            };

            FunctionList.Add(item);
            return(item);
        }
 public void PlayFunctionsAndAudio(Action onFinished, AudioClip clip, FunctionList funcs, string name,
                                   NodeFunctionRunner coroutineRunner)
 {
     coroutineRunner.StopAllCoroutines();
     coroutineRunner.StartCoroutine(
         InvokeFunctionsAndPlayAudioCoroutine(
             name,
             clip,
             funcs,
             onFinished,
             coroutineRunner));
 }
Exemplo n.º 15
0
        public async Task <IActionResult> GetFunctionsAsync([FromQuery] FunctionGetModel model)
        {
            model.Validate();

            var list = await _functionRepository.GetFunctionsAsync(model.Keyword, model.IsActive, model.Page, model.PageSize);

            if (list.Items.Count == 0)
            {
                throw new NotFound404Exception("page");
            }

            return(Ok(FunctionList.GetFrom(list)));
        }
Exemplo n.º 16
0
        static IEnumerable <UIStateUpdate> GetUpdates(FunctionList oldState, FunctionList newState)
        {
            // We generate intermediate states (!?)
            if (oldState.FormulaEditWindow != newState.FormulaEditWindow)
            {
                // Always changes together with Move ...?
                var tempState = oldState.WithFormulaEditWindow(newState.FormulaEditWindow);
                yield return(new UIStateUpdate(oldState, tempState, UIStateUpdate.UpdateType.FormulaEditWindowChange));

                oldState = (FunctionList)tempState;
            }
            if (oldState.FunctionListWindow != newState.FunctionListWindow)
            {
                Debug.Print(">>>>> Unexpected FunctionListWindowChange");  // Should never change???
                var tempState = oldState.WithFunctionListWindow(newState.FunctionListWindow);
                yield return(new UIStateUpdate(oldState, tempState, UIStateUpdate.UpdateType.FunctionListWindowChange));

                oldState = tempState;
            }
            if (oldState.EditWindowBounds != newState.EditWindowBounds)
            {
                var tempState = oldState.WithBounds(newState.EditWindowBounds);
                yield return(new UIStateUpdate(oldState, tempState, UIStateUpdate.UpdateType.FormulaEditMove));

                oldState = (FunctionList)tempState;
            }
            if (oldState.ExcelToolTipWindow != newState.ExcelToolTipWindow)
            {
                var tempState = oldState.WithToolTipWindow(newState.ExcelToolTipWindow);
                yield return(new UIStateUpdate(oldState, tempState, UIStateUpdate.UpdateType.FormulaEditExcelToolTipChange));

                oldState = (FunctionList)tempState;
            }
            if (oldState.FormulaPrefix != newState.FormulaPrefix)
            {
                var tempState = oldState.WithFormulaPrefix(newState.FormulaPrefix);
                yield return(new UIStateUpdate(oldState, tempState, UIStateUpdate.UpdateType.FormulaEditTextChange));

                oldState = (FunctionList)tempState;
            }
            if (oldState.SelectedItemText != newState.SelectedItemText ||
                oldState.SelectedItemBounds != newState.SelectedItemBounds ||
                oldState.FunctionListBounds != newState.FunctionListBounds)
            {
                yield return(new UIStateUpdate(oldState, newState, UIStateUpdate.UpdateType.FunctionListSelectedItemChange));
            }
        }
Exemplo n.º 17
0
        bool Invoke(string name, FunctionStack stack, Dictionary <string, FunctionList> table)
        {
            if (table.ContainsKey(name))
            {
                FunctionList list = table[name];
                foreach (FunctionAdapter adapter in list)
                {
                    if (adapter.IsSuitable(stack))
                    {
                        adapter.Invoke(stack);
                        return(true);
                    }
                }
            }

            return(false);
        }
Exemplo n.º 18
0
        private void ColorlyoutItem_Click(object sender, RoutedEventArgs e)
        {
            if (!(sender is FrameworkElement element))
            {
                return;
            }

            if (element.DataContext is FunctionData funtion)
            {
                Flyout colorFlyout = GetColorFlyout();

                ColorControl.Function = funtion;
                if (FunctionList.ContainerFromItem(funtion) is FrameworkElement container)
                {
                    colorFlyout.ShowAt(container);
                }
            }
        }
Exemplo n.º 19
0
        private void FunctionList_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (!(e.ClickedItem is FunctionData function))
            {
                return;
            }

            // Don't animate the first item since it is already in its final position on the EditBar.
            if (function.Id != 1 && FunctionList.ContainerFromItem(function) is UIElement container)
            {
                ConnectedAnimationService.GetForCurrentView().PrepareToAnimate(BeginEditAnimationName, container);
            }

            AppTelemetry.Current.TrackEvent(
                TelemetryEvents.EditFunction,
                TelemetryProperties.Function,
                function.Name);

            OnFunctionEdited(function);
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!MyMessage.MsgOkCancel("Do you want to save?\n\n" +
                                       "Click \"OK\" to confirm.\n\n" +
                                       "Click \"Cancel\" to cancel."))
            {
                return;
            }
            try
            {
                var offsetList = new List <OffsetInfo>();
                for (var i = 0; i < dataList.Rows.Count; i++)
                {
                    var offset = new OffsetInfo
                    {
                        OffsetId = i,
                        Offset   = dataList.Rows[i].Cells[0].Value.ToString(),
                        Hex      = dataList.Rows[i].Cells[1].Value.ToString()
                    };
                    offsetList.Add(offset);
                }

                var functionList = new FunctionList()
                {
                    CheatName     = txtNameCheat.Text,
                    FunctionValue = txtValues.Text,
                    FunctionType  = _type,
                    OffsetList    = offsetList
                };

                OffsetPatch.FunctionList[_index] = functionList;

                Dispose();
            }
            catch (Exception exception)
            {
                MyMessage.MsgShowError("Error" + exception.Message);
            }
        }
Exemplo n.º 21
0
        public ActionResult AddFunctionList(int TemplateType, int VersionId, string VersionName, int Price)
        {
            FunctionList functionList = new FunctionList();

            functionList.TemplateType    = TemplateType;
            functionList.VersionId       = VersionId;
            functionList.VersionName     = VersionName;
            functionList.Price           = Price;
            functionList.AddTime         = DateTime.Now;
            functionList.UpdateTime      = DateTime.Now;
            functionList.PageConfig      = JsonConvert.SerializeObject(new PageConfig());
            functionList.ComsConfig      = JsonConvert.SerializeObject(new ComsConfig());
            functionList.ProductMgr      = JsonConvert.SerializeObject(new ProductMgr());
            functionList.StoreConfig     = JsonConvert.SerializeObject(new StoreConfig());
            functionList.NewsMgr         = JsonConvert.SerializeObject(new NewsMgr());
            functionList.MessageMgr      = JsonConvert.SerializeObject(new MessageMgr());
            functionList.MarketingPlugin = JsonConvert.SerializeObject(new MarketingPlugin());
            functionList.OperationMgr    = JsonConvert.SerializeObject(new OperationMgr());
            functionList.FuncMgr         = JsonConvert.SerializeObject(new FuncMgr());
            int id = Convert.ToInt32(FunctionListBLL.SingleModel.Add(functionList));

            return(Json(new { isok = true, msg = "成功", obj = id }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 22
0
        public ActionResult Admin(XcxAppAccountRelation authData)
        {
            if (authData == null)
            {
                return(View("PageError", new Return_Msg()
                {
                    Msg = "无效参数!", code = "500"
                }));
            }

            XcxTemplate xcxTemplate = XcxTemplateBLL.SingleModel.GetModel(authData.TId);
            bool        isAvailable = false;

            if (xcxTemplate.Type == (int)TmpType.小程序专业模板)
            {
                FunctionList functionList = new FunctionList();
                functionList = FunctionListBLL.SingleModel.GetModel($"TemplateType={xcxTemplate.Type} and VersionId={authData.VersionId}");
                if (functionList == null)
                {
                    return(View("PageError", new Return_Msg()
                    {
                        Msg = "功能权限未设置!", code = "500"
                    }));
                }
                if (!string.IsNullOrEmpty(functionList.ComsConfig))
                {
                    functionList.ComsConfigModel = JsonConvert.DeserializeObject <ComsConfig>(functionList.ComsConfig);
                }
                isAvailable = functionList.ComsConfigModel?.FlashDeal == 0;
            }
            ViewBag.appId       = authData.Id;
            ViewBag.PageType    = xcxTemplate.Type;
            ViewBag.isAvailable = isAvailable;
            ViewBag.versionId   = authData.VersionId;
            return(View());
        }
        public int SaveRows(DbTransaction pTran, FunctionList FunctionList)
        {
            int intRows = 0;

            for (int i = 0; i < FunctionList.Count; i++)
            {
                switch (FunctionList[i].CommonState)
                {
                case CommonState.Added:
                    intRows += InsertRow(pTran, FunctionList[i]);
                    break;

                case CommonState.Modified:
                    intRows += UpdateRow(pTran, FunctionList[i]);
                    break;

                case CommonState.Deleted:
                    intRows += DeleteRow(pTran, FunctionList[i]);
                    break;
                }
            }

            return(intRows);
        }
Exemplo n.º 24
0
        public void AddFunctionToPlot(FunctionList function)
        {
            function.IsChecked = true;
            ObsFunctionList.Add(function);

            ThePlotModel.Series.Add(function.Function);

            ThePlotModel.InvalidatePlot(true);
        }
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        EditorGUILayout.BeginVertical("Box");

        // ----- < BAR NAME > ----- //
        if (statusName.stringValue == string.Empty && Event.current.type == EventType.Repaint)
        {
            GUIStyle style = new GUIStyle(GUI.skin.textField);
            style.normal.textColor = new Color(0.5f, 0.5f, 0.5f, 0.75f);
            EditorGUILayout.TextField(new GUIContent("Bar Name", "The unique name to be used in reference to this bar."), "Bar Name", style);
        }
        else
        {
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(statusName, new GUIContent("Bar Name", "The unique name to be used in reference to this bar."));
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
                DuplicateStatusName.target = GetDuplicateBarName();
                NameUnassigned.target      = targ.barName == string.Empty;
                ExampleCode.target         = targ.barName != string.Empty && !GetDuplicateBarName();
                GenerateExampleCode();
            }
        }
        // ----- < END BAR NAME > ----- //

        // ----- < NAME ERRORS > ----- //
        if (EditorGUILayout.BeginFadeGroup(DuplicateStatusName.faded))
        {
            EditorGUILayout.HelpBox("The bar name \"" + targ.barName + "\" is already being used in this scene. Please make each Simple Health Bar has a unique name.", MessageType.Warning);
        }
        EditorGUILayout.EndFadeGroup();

        if (EditorGUILayout.BeginFadeGroup(ExampleCode.faded))
        {
            GUILayout.Space(1);
            EditorGUILayout.LabelField("Example Code Generator", EditorStyles.boldLabel);
            EditorGUI.BeginChangeCheck();
            functionList = ( FunctionList )EditorGUILayout.EnumPopup("Function", functionList);
            if (EditorGUI.EndChangeCheck())
            {
                GenerateExampleCode();
            }

            EditorGUILayout.TextField(exampleCode);

            GUILayout.Space(1);
        }
        EditorGUILayout.EndFadeGroup();
        // ----- < END NAME ERRORS > ----- //

        EditorGUILayout.EndVertical();

        // ----- < BAR IMAGE > ----- //
        EditorGUI.BeginChangeCheck();
        EditorGUILayout.PropertyField(statusImage, new GUIContent("Image", "The image component to be used for this bar."));
        if (EditorGUI.EndChangeCheck())
        {
            serializedObject.ApplyModifiedProperties();
            if (targ.barImage != null && targ.barImage.type != Image.Type.Filled)
            {
                targ.barImage.type       = Image.Type.Filled;
                targ.barImage.fillMethod = Image.FillMethod.Horizontal;
                EditorUtility.SetDirty(targ.barImage);
            }
            if (targ.barImage != null)
            {
                statusColor.colorValue = targ.barImage.color;
                serializedObject.ApplyModifiedProperties();
            }
            targ.UpdateBar(testValue, 100.0f);

            ImageWarning.target          = GetBarImageWarning();
            StatusImageAssigned.target   = GetImageAssigned();
            StatusImageUnassigned.target = GetImageUnassigned();
        }

        if (EditorGUILayout.BeginFadeGroup(StatusImageUnassigned.faded))
        {
            EditorGUILayout.BeginVertical("Box");
            EditorGUILayout.HelpBox("Image is unassigned.", MessageType.Warning);
            if (GUILayout.Button("Find", EditorStyles.miniButton))
            {
                statusImage.objectReferenceValue = targ.GetComponent <Image>();
                serializedObject.ApplyModifiedProperties();
                if (targ.barImage != null)
                {
                    targ.barImage.type       = Image.Type.Filled;
                    targ.barImage.fillMethod = Image.FillMethod.Horizontal;
                    EditorUtility.SetDirty(targ.barImage);

                    statusColor.colorValue = targ.barImage.color;
                    serializedObject.ApplyModifiedProperties();
                }

                ImageWarning.target          = GetBarImageWarning();
                StatusImageAssigned.target   = GetImageAssigned();
                StatusImageUnassigned.target = GetImageUnassigned();
            }
            EditorGUILayout.EndVertical();
        }
        EditorGUILayout.EndFadeGroup();
        // ----- < END BAR IMAGE > ----- //

        if (EditorGUILayout.BeginFadeGroup(StatusImageAssigned.faded))
        {
            // ----- < BAR IMAGE ERROR > ----- //
            if (EditorGUILayout.BeginFadeGroup(ImageWarning.faded))
            {
                EditorGUILayout.BeginVertical("Box");
                EditorGUILayout.HelpBox("Invalid Image Type: " + targ.barImage.type.ToString(), MessageType.Warning);
                if (GUILayout.Button("Fix", EditorStyles.miniButton))
                {
                    targ.barImage.type = Image.Type.Filled;
                    EditorUtility.SetDirty(targ.barImage);

                    ImageWarning.target = GetBarImageWarning();
                }
                EditorGUILayout.EndVertical();
            }
            if (StatusImageAssigned.faded == 1.0f)
            {
                EditorGUILayout.EndFadeGroup();
            }
            // ----- < END BAR IMAGE ERROR > ----- //

            // ----- < BAR COLORS > ----- //
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(colorMode, new GUIContent("Color Mode", "The mode in which to display the color to the image component."));
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
                UpdateColor();
                ImageColorWarning.target = GetColorWarning();
            }

            EditorGUI.BeginChangeCheck();
            EditorGUI.indentLevel = 1;
            if (targ.colorMode == SimpleHealthBar.ColorMode.Single)
            {
                EditorGUILayout.PropertyField(statusColor, new GUIContent("Image Color", "The color of this image."));
            }
            else
            {
                EditorGUILayout.PropertyField(statusGradient, new GUIContent("Image Gradient", "The color gradient of this image."));
            }
            EditorGUI.indentLevel = 0;
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
                UpdateColor();
                ImageColorWarning.target = GetColorWarning();
            }

            if (EditorGUILayout.BeginFadeGroup(ImageColorWarning.faded))
            {
                EditorGUILayout.BeginVertical("Box");
                EditorGUILayout.HelpBox("Image color has been modified incorrectly.", MessageType.Warning);
                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button("Update Image", EditorStyles.miniButtonLeft))
                {
                    targ.barImage.color = statusColor.colorValue;
                    EditorUtility.SetDirty(targ.barImage);
                    ImageColorWarning.target = GetColorWarning();
                }
                if (GUILayout.Button("Update Script", EditorStyles.miniButtonRight))
                {
                    statusColor.colorValue = targ.barImage.color;
                    serializedObject.ApplyModifiedProperties();
                    ImageColorWarning.target = GetColorWarning();
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndVertical();
            }
            if (StatusImageAssigned.faded == 1.0f)
            {
                EditorGUILayout.EndFadeGroup();
            }
            // ----- < END BAR COLORS > ----- //

            EditorGUILayout.Space();

            // ------- < TEXT OPTIONS > ------- //
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(displayText, new GUIContent("Display Text", "Determines how this bar will display text to the user."));
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
                DisplayTextOptions.target = targ.displayText != SimpleHealthBar.DisplayText.Disabled;

                targ.UpdateBar(testValue, 100.0f);
                if (statusText.objectReferenceValue != null)
                {
                    EditorUtility.SetDirty(targ.barText);
                }
            }

            if (EditorGUILayout.BeginFadeGroup(DisplayTextOptions.faded))
            {
                EditorGUI.indentLevel = 1;

                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(statusText, new GUIContent("Text", "The Text component to be used for the status text."));
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                    targ.UpdateTextColor(statusTextColor);
                    targ.UpdateBar(testValue, 100.0f);
                    if (statusText.objectReferenceValue != null)
                    {
                        EditorUtility.SetDirty(targ.barText);
                    }
                }

                EditorGUI.BeginChangeCheck();
                statusTextColor = EditorGUILayout.ColorField(new GUIContent("Text Color", "The color of the Text component."), statusTextColor);
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                    targ.UpdateTextColor(statusTextColor);
                    if (statusText.objectReferenceValue != null)
                    {
                        EditorUtility.SetDirty(targ.barText);
                    }
                }

                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(additionalText, new GUIContent("Additional Text", "Additional text to be displayed before the current information."));
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                    targ.UpdateBar(testValue, 100.0f);
                    if (statusText.objectReferenceValue != null)
                    {
                        EditorUtility.SetDirty(targ.barText);
                    }
                }

                EditorGUI.indentLevel = 2;
                switch (targ.displayText)
                {
                case SimpleHealthBar.DisplayText.Percentage:
                {
                    EditorGUILayout.LabelField("Text Preview: " + targ.additionalText + testValue + "%");
                }
                break;

                case SimpleHealthBar.DisplayText.CurrentValue:
                {
                    EditorGUILayout.LabelField("Text Preview: " + targ.additionalText + testValue);
                }
                break;

                case SimpleHealthBar.DisplayText.CurrentAndMaxValues:
                {
                    EditorGUILayout.LabelField("Text Preview: " + targ.additionalText + testValue + " / 100");
                }
                break;

                default:
                {
                    EditorGUILayout.LabelField("Text Preview: Default");
                }
                break;
                }
                EditorGUI.indentLevel = 0;
                EditorGUILayout.Space();
            }
            if (StatusImageAssigned.faded == 1.0f)
            {
                EditorGUILayout.EndFadeGroup();
            }
            // ----- < END TEXT OPTIONS > ----- //

            // ----- < FILL CONSTRAINT > ----- //
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(fillConstraint, new GUIContent("Fill Constraint", "Determines whether or not the image fill should be constrained."));
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
                FillConstraintOptions.target = targ.fillConstraint;
            }

            if (EditorGUILayout.BeginFadeGroup(FillConstraintOptions.faded))
            {
                EditorGUI.indentLevel = 1;

                EditorGUI.BeginChangeCheck();
                EditorGUILayout.Slider(fillConstraintMin, 0.0f, targ.fillConstraintMax, new GUIContent("Fill Minimum", "The minimum fill amount."));
                EditorGUILayout.Slider(fillConstraintMax, targ.fillConstraintMin, 1.0f, new GUIContent("Fill Maximum", "The maximum fill amount."));
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                    if (targ.barImage != null)
                    {
                        targ.barImage.enabled = false;
                        targ.UpdateBar(testValue, 100.0f);
                        targ.barImage.enabled = true;
                    }
                }

                EditorGUI.indentLevel = 0;
                EditorGUILayout.Space();
            }
            if (StatusImageAssigned.faded == 1.0f)
            {
                EditorGUILayout.EndFadeGroup();
            }
            // --- < END FILL CONSTRAINT > --- //

            // ----- < TEST VALUE > ----- //
            EditorGUI.BeginChangeCheck();
            testValue = EditorGUILayout.Slider(new GUIContent("Test Value"), testValue, 0.0f, 100.0f);
            if (EditorGUI.EndChangeCheck())
            {
                if (targ.barImage != null)
                {
                    targ.barImage.enabled = false;
                    targ.UpdateBar(testValue, 100.0f);
                    targ.barImage.enabled = true;

                    EditorUtility.SetDirty(targ.barImage);
                }
            }
            // ----- < END TEST VALUE > ----- //
        }
        EditorGUILayout.EndFadeGroup();

        Repaint();
    }
Exemplo n.º 26
0
        public override string ToString()
        {
            bool checkLHS  = LHS().GetID().Equals(FMul.ID, StringComparison.CurrentCultureIgnoreCase) || FunctionList.IsSingleOperandFunction(LHS().GetID());
            bool checkRHS  = RHS().GetID().Equals(FMul.ID, StringComparison.CurrentCultureIgnoreCase) || FunctionList.IsSingleOperandFunction(RHS().GetID());
            bool checkBoth = checkLHS && checkRHS;

            if (checkBoth)
            {
                return(LHS().ToString() + "*" + RHS().ToString());
            }

            if (checkLHS)
            {
                return(LHS().ToString() + "*(" + RHS().ToString() + ")");
            }

            if (checkRHS)
            {
                return("(" + LHS().ToString() + ")*" + RHS().ToString());
            }

            return("(" + LHS().ToString() + ")*(" + RHS().ToString() + ")");
        }
Exemplo n.º 27
0
            public CircuitFunction Get()
            {
                int random;
                int count = this.current.Count;

                if (count <= this.index)
                {
                    count = this.next.Count;
                    if (count <= 0)
                    {
                        return(null);
                    }

                                        #if VALIDATE_GET_FUNCTION
                    Tracer.Assert(this.functionCount == this.functionIndex.Count);
                    Tracer.Assert(this.functionCount == 0 || (this.functionIndex.Contains(0) && this.functionIndex.Contains(this.functionCount - 1)));
                    this.functionCount = count;
                    this.functionIndex.Clear();
                                        #endif

                    this.iteration++;
                    this.current.Clear();
                    FunctionList temp = this.next;
                    this.next    = this.current;
                    this.current = temp;

                    this.index = 1;

                    // This expression for step will allow to iterate for this.index from 0 to this.current.Count - 1 and walk through each element
                    // of this.current exactly once because int.MaxValue is prime number
                    this.step = int.MaxValue % count;

                    // simple but fast random number generator
                    this.seed = 214013 * this.seed + 2531011;

                    // this will just make sure: 0 <= random < count
                    random      = (int.MaxValue & this.seed) % count;
                    this.offset = random;

                    if (0 < this.Delay && 1 < count)
                    {
                        int max = Math.Min(this.Delay, count - 1);
                        for (int i = 0; i < max; i++)
                        {
                            this.Add(this.Get());
                        }
                    }
                                        #if REPORT_STAT
                    this.ReportStat(this.current.Count);
                                        #endif
                }
                else
                {
                    this.index++;
                    random = this.offset - this.step;
                    if (random < 0)
                    {
                        random += count;
                    }
                    this.offset = random;
                }

                                #if VALIDATE_GET_FUNCTION
                Tracer.Assert(0 <= random && random < this.functionCount && this.functionIndex.Add(random));
                                #endif

                return(this.current[random]);
            }
Exemplo n.º 28
0
 public void visitFunctionList(FunctionList fl)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 29
0
        private void DerivativeClick(object sender, RoutedEventArgs e)
        {
            if( ((CheckBox)sender).IsChecked == false)
                return;
            try
            {
                var path = Directory.GetCurrentDirectory();
                var file = File.ReadAllText(path + SchemePath + FileDerivative);
                string function = string.Format("(derivativeFunc {0} {1} {2} {3})", XMin, XMax, DataPoints, CodeBox.Text);

                var dataString = string.Format(file + function);
                dynamic data = SchemeCalculation(dataString);

                var functionList = new FunctionList()
                {
                    Function = CreateFunction(data, LineStyle.Dot),
                    Name = "Derivative",
                    SchemeFunction = function,
                    IsNotDerivative = false,
                    IsNotIntegral = true,
                    IsChecked = true,
                };

                if (functionList.Function == null)
                    return;

                functionList.ID = _idCounter++;
                AddFunctionToPlot(functionList);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Sorry to bother you!");
            }
        }
Exemplo n.º 30
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        EditorGUILayout.Space();

        EditorGUILayout.BeginVertical("Box");

        // ----- < BAR NAME > ----- //
        if (barName == string.Empty && Event.current.type == EventType.Repaint)
        {
            GUIStyle style = new GUIStyle(GUI.skin.textField);
            style.normal.textColor = new Color(0.5f, 0.5f, 0.5f, 0.75f);
            EditorGUILayout.TextField(new GUIContent("Bar Name", "The unique name to be used in reference to this bar."), "Bar Name", style);
        }
        else
        {
            EditorGUI.BeginChangeCheck();
            barName = EditorGUILayout.TextField(new GUIContent("Bar Name", "The unique name to be used in reference to this bar."), barName);
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
                ExampleCode.target = barName != string.Empty;
                GenerateExampleCode();
            }
        }
        // ----- < END BAR NAME > ----- //

        // ----- < NAME ERRORS > ----- //
        if (EditorGUILayout.BeginFadeGroup(ExampleCode.faded))
        {
            GUILayout.Space(1);

            EditorGUILayout.LabelField("Public Variable", EditorStyles.boldLabel);
            EditorGUILayout.LabelField("Copy this variable declaration into your custom scripts.", EditorStyles.wordWrappedLabel);
            EditorGUILayout.TextField("public SimpleHealthBar " + barName + ";");

            EditorGUILayout.LabelField("Example Code Generator", EditorStyles.boldLabel);
            EditorGUILayout.LabelField("Please choose the function that you want to use. Afterward, copy and paste the provided code into your scripts where you want to display a status to the user.", EditorStyles.wordWrappedLabel);
            EditorGUI.BeginChangeCheck();
            functionList = ( FunctionList )EditorGUILayout.EnumPopup("Function", functionList);
            if (EditorGUI.EndChangeCheck())
            {
                GenerateExampleCode();
            }

            EditorGUILayout.TextField(exampleCode);

            GUILayout.Space(1);
        }
        EditorGUILayout.EndFadeGroup();
        // ----- < END NAME ERRORS > ----- //

        EditorGUILayout.EndVertical();

        // ----- < BAR IMAGE > ----- //
        EditorGUI.BeginChangeCheck();
        EditorGUILayout.PropertyField(barImage, new GUIContent("Bar Image", "The image component to be used for this bar."));
        EditorGUILayout.PropertyField(barImageBG, new GUIContent("Bar Image BackGround", "The BackGround image component to be used for this bar."));

        if (EditorGUI.EndChangeCheck())
        {
            serializedObject.ApplyModifiedProperties();
            if (targ.barImage != null && targ.barImage.type != Image.Type.Filled)
            {
                targ.barImage.type       = Image.Type.Filled;
                targ.barImage.fillMethod = Image.FillMethod.Horizontal;
                EditorUtility.SetDirty(targ.barImage);
            }
            if (targ.barImage != null)
            {
                barColor.colorValue = targ.barImage.color;
                serializedObject.ApplyModifiedProperties();
            }
            targ.UpdateBar(testValue, 100.0f);

            ImageFilledWarning.target = GetBarImageWarning();
            ImageAssigned.target      = GetImageAssigned();
            ImageUnassigned.target    = GetImageUnassigned();
        }

        if (EditorGUILayout.BeginFadeGroup(ImageUnassigned.faded))
        {
            EditorGUILayout.BeginVertical("Box");
            EditorGUILayout.HelpBox("Image is unassigned.", MessageType.Warning);
            if (GUILayout.Button("Find", EditorStyles.miniButton))
            {
                barImage.objectReferenceValue = targ.GetComponent <Image>();
                serializedObject.ApplyModifiedProperties();
                if (targ.barImage != null)
                {
                    if (targ.barImage.type != Image.Type.Filled)
                    {
                        targ.barImage.type       = Image.Type.Filled;
                        targ.barImage.fillMethod = Image.FillMethod.Horizontal;
                        EditorUtility.SetDirty(targ.barImage);
                    }

                    barColor.colorValue = targ.barImage.color;
                    serializedObject.ApplyModifiedProperties();
                }

                ImageFilledWarning.target = GetBarImageWarning();
                ImageAssigned.target      = GetImageAssigned();
                ImageUnassigned.target    = GetImageUnassigned();
            }
            EditorGUILayout.EndVertical();
        }
        EditorGUILayout.EndFadeGroup();
        // ----- < END BAR IMAGE > ----- //

        if (EditorGUILayout.BeginFadeGroup(ImageAssigned.faded))
        {
            // ----- < BAR IMAGE ERROR > ----- //
            if (EditorGUILayout.BeginFadeGroup(ImageFilledWarning.faded))
            {
                EditorGUILayout.BeginVertical("Box");
                EditorGUILayout.HelpBox("Invalid Image Type: " + targ.barImage.type.ToString(), MessageType.Warning);
                if (GUILayout.Button("Fix", EditorStyles.miniButton))
                {
                    targ.barImage.type = Image.Type.Filled;
                    EditorUtility.SetDirty(targ.barImage);

                    ImageFilledWarning.target = GetBarImageWarning();
                }
                EditorGUILayout.EndVertical();
            }
            if (ImageAssigned.faded == 1.0f)
            {
                EditorGUILayout.EndFadeGroup();
            }
            // ----- < END BAR IMAGE ERROR > ----- //

            // ----- < BAR COLORS > ----- //
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(colorMode, new GUIContent("Color Mode", "The mode in which to display the color to the barImage component."));
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
                UpdateStatusColor();
                ImageColorWarning.target = GetColorWarning();
            }

            EditorGUI.BeginChangeCheck();
            EditorGUI.indentLevel = 1;
            if (targ.colorMode == SimpleHealthBar.ColorMode.Single)
            {
                EditorGUILayout.PropertyField(barColor, new GUIContent("Color", "The color of this barImage."));
            }
            else
            {
                EditorGUILayout.PropertyField(barGradient, new GUIContent("Gradient", "The color gradient of this barImage."));
            }
            EditorGUI.indentLevel = 0;
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
                UpdateStatusColor();
                ImageColorWarning.target = GetColorWarning();
            }

            if (GetColorWarning())
            {
                ImageColorWarning.target = GetColorWarning();
            }

            if (EditorGUILayout.BeginFadeGroup(ImageColorWarning.faded))
            {
                EditorGUILayout.BeginVertical("Box");
                EditorGUILayout.HelpBox("Image color has been modified incorrectly.", MessageType.Warning);
                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button("Update Image", EditorStyles.miniButtonLeft))
                {
                    targ.barImage.color = barColor.colorValue;
                    EditorUtility.SetDirty(targ.barImage);
                    ImageColorWarning.target = GetColorWarning();
                }
                if (GUILayout.Button("Update Script", EditorStyles.miniButtonRight))
                {
                    barColor.colorValue = targ.barImage.color;
                    serializedObject.ApplyModifiedProperties();
                    ImageColorWarning.target = GetColorWarning();
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndVertical();
            }
            if (ImageAssigned.faded == 1.0f)
            {
                EditorGUILayout.EndFadeGroup();
            }
            // ----- < END BAR COLORS > ----- //

            EditorGUILayout.Space();

            // ------- < TEXT OPTIONS > ------- //
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(displayText, new GUIContent("Display Text", "Determines how this bar will display text to the user."));
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
                DisplayTextOption.target = targ.displayText != SimpleHealthBar.DisplayText.Disabled;

                targ.UpdateBar(testValue, 100.0f);
                if (barText.objectReferenceValue != null)
                {
                    EditorUtility.SetDirty(targ.barText);
                }
            }

            if (EditorGUILayout.BeginFadeGroup(DisplayTextOption.faded))
            {
                EditorGUI.indentLevel = 1;

                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(barText, new GUIContent("Bar Text", "The Text component to be used for the text."));
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                    targ.UpdateTextColor(textColor);
                    targ.UpdateBar(testValue, 100.0f);
                    if (barText.objectReferenceValue != null)
                    {
                        EditorUtility.SetDirty(targ.barText);
                    }
                }

                EditorGUI.BeginChangeCheck();
                textColor = EditorGUILayout.ColorField(new GUIContent("Text Color", "The color of the Text component."), textColor);
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                    targ.UpdateTextColor(textColor);
                    if (barText.objectReferenceValue != null)
                    {
                        EditorUtility.SetDirty(targ.barText);
                    }
                }

                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(additionalText, new GUIContent("Additional Text", "Additional text to be displayed before the current information."));
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                    targ.UpdateBar(testValue, 100.0f);
                    if (barText.objectReferenceValue != null)
                    {
                        EditorUtility.SetDirty(targ.barText);
                    }
                }

                EditorGUI.indentLevel = 2;
                switch (targ.displayText)
                {
                case SimpleHealthBar.DisplayText.Percentage:
                {
                    EditorGUILayout.LabelField("Text Preview: " + targ.additionalText + testValue + "%");
                }
                break;

                case SimpleHealthBar.DisplayText.CurrentValue:
                {
                    EditorGUILayout.LabelField("Text Preview: " + targ.additionalText + testValue);
                }
                break;

                case SimpleHealthBar.DisplayText.CurrentAndMaxValues:
                {
                    EditorGUILayout.LabelField("Text Preview: " + targ.additionalText + testValue + " / 100");
                }
                break;

                default:
                {
                    EditorGUILayout.LabelField("Text Preview: Default");
                }
                break;
                }
                EditorGUI.indentLevel = 0;
                EditorGUILayout.Space();
            }
            if (ImageAssigned.faded == 1.0f)
            {
                EditorGUILayout.EndFadeGroup();
            }
            // ----- < END TEXT OPTIONS > ----- //

            // ----- < TEST VALUE > ----- //
            EditorGUI.BeginChangeCheck();
            testValue = EditorGUILayout.Slider(new GUIContent("Test Value"), testValue, 0.0f, 100.0f);
            if (EditorGUI.EndChangeCheck())
            {
                if (targ.barImage != null)
                {
                    targ.barImage.enabled = false;
                    targ.UpdateBar(testValue, 100.0f);
                    targ.barImage.enabled = true;
                    EditorUtility.SetDirty(targ.barImage);
                }
            }
            // ----- < END TEST VALUE > ----- //
        }
        EditorGUILayout.EndFadeGroup();

        EditorGUILayout.Space();

        Repaint();
    }
Exemplo n.º 31
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        EditorGUILayout.Space();

        EditorGUILayout.BeginVertical("Box");

        // ----- < BAR NAME > ----- //
        if (barName.stringValue == string.Empty && Event.current.type == EventType.Repaint)
        {
            GUIStyle style = new GUIStyle(GUI.skin.textField);
            style.normal.textColor = new Color(0.5f, 0.5f, 0.5f, 0.75f);
            EditorGUILayout.TextField(new GUIContent("Bar Name", "The unique name to be used in reference to this bar."), "Bar Name", style);
        }
        else
        {
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(barName, new GUIContent("Bar Name", "The unique name to be used in reference to this bar."));
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
                DuplicateBarName.target = GetDuplicateBarName();
                ExampleCode.target      = targ.barName != string.Empty && !GetDuplicateBarName();
                GenerateExampleCode();
            }
        }
        // ----- < END BAR NAME > ----- //

        // ----- < NAME ERRORS > ----- //
        if (EditorGUILayout.BeginFadeGroup(DuplicateBarName.faded))
        {
            EditorGUILayout.HelpBox("The bar name \"" + targ.barName + "\" is already being used in this scene. Please make each Ultimate Health Bar has a unique name.", MessageType.Warning);
        }
        EditorGUILayout.EndFadeGroup();

        if (EditorGUILayout.BeginFadeGroup(ExampleCode.faded))
        {
            GUILayout.Space(1);
            EditorGUILayout.LabelField("Example Code Generator", EditorStyles.boldLabel);
            EditorGUI.BeginChangeCheck();
            functionList = ( FunctionList )EditorGUILayout.EnumPopup("Function", functionList);
            if (EditorGUI.EndChangeCheck())
            {
                GenerateExampleCode();
            }

            EditorGUILayout.TextField(exampleCode);

            GUILayout.Space(1);
        }
        EditorGUILayout.EndFadeGroup();
        // ----- < END NAME ERRORS > ----- //

        EditorGUILayout.EndVertical();

        EditorGUI.BeginChangeCheck();
        EditorGUILayout.PropertyField(updateVisibility, new GUIContent("Update Visibility", "Determines how the script calculates the visibility of the Ultimate Health Bars."));
        if (EditorGUI.EndChangeCheck())
        {
            serializedObject.ApplyModifiedProperties();

            UpdateVisibilityOnActivity.target = GetUpdateVisibilityOnStatusUpdated();
            ShowChildHealthBars.target        = GetUpdateVisibilityOnStatusUpdated();
        }

        if (EditorGUILayout.BeginFadeGroup(UpdateVisibilityOnActivity.faded))
        {
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(idleSeconds, new GUIContent("Idle Seconds", "Time in seconds to wait before fading out."));
            if (EditorGUI.EndChangeCheck())
            {
                if (idleSeconds.floatValue < 0)
                {
                    idleSeconds.floatValue = 0;
                }

                serializedObject.ApplyModifiedProperties();
            }
        }
        EditorGUILayout.EndFadeGroup();

        EditorGUI.BeginChangeCheck();
        EditorGUILayout.PropertyField(initialState, new GUIContent("Initial State", "The initial state of the visibility."));
        EditorGUILayout.PropertyField(enableDuration, new GUIContent("Enable Duration", "Time in seconds before the alpha reaches full enabled."));
        EditorGUILayout.PropertyField(disableDuration, new GUIContent("Disable Duration", "Time in seconds before the alpha reaches full disabled."));
        if (EditorGUI.EndChangeCheck())
        {
            if (enableDuration.floatValue < 0)
            {
                enableDuration.floatValue = 0;
            }

            if (disableDuration.floatValue < 0)
            {
                disableDuration.floatValue = 0;
            }

            serializedObject.ApplyModifiedProperties();
        }

        EditorGUI.BeginChangeCheck();
        EditorGUILayout.Slider(enabledAlpha, 0.0f, 1.0f, new GUIContent("Enabled Alpha", "The target alpha when the visibility is enabled."));
        EditorGUILayout.Slider(disabledAlpha, 0.0f, 1.0f, new GUIContent("Disabled Alpha", "The target alpha when the visibility is disabled."));
        if (EditorGUI.EndChangeCheck())
        {
            serializedObject.ApplyModifiedProperties();

            targ.GetComponent <CanvasGroup>().alpha = enabledAlpha.floatValue;
            EditorUtility.SetDirty(targ.gameObject);
        }

        EditorGUILayout.Space();

        if (EditorGUILayout.BeginFadeGroup(UpdateVisibilityOnActivity.faded))
        {
            EditorGUILayout.BeginVertical("Toolbar");
            EditorGUILayout.LabelField("Simple Health Bars", EditorStyles.boldLabel);
            EditorGUILayout.EndVertical();

            for (int i = 0; i < targ.healthBarInformation.Count; i++)
            {
                EditorGUILayout.BeginVertical("Box");
                EditorGUILayout.LabelField(names[i], EditorStyles.boldLabel);
                EditorGUI.BeginDisabledGroup(Application.isPlaying);
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(keepVisible[i]);
                if (keepVisible[i].boolValue == true)
                {
                    EditorGUILayout.Slider(triggerValue[i], 0.0f, 1.0f);
                }
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                }
                EditorGUI.EndDisabledGroup();

                EditorGUI.BeginChangeCheck();
                testValue[i] = EditorGUILayout.Slider(new GUIContent("Test Value", "The test value for the Ultimate Health Bar."), testValue[i], 0.0f, 100.0f);
                if (EditorGUI.EndChangeCheck())
                {
                    if (targ.healthBarInformation[i].healthBar.barImage != null)
                    {
                        targ.healthBarInformation[i].healthBar.barImage.enabled = false;
                        targ.healthBarInformation[i].healthBar.UpdateBar(testValue[i], 100);
                        targ.healthBarInformation[i].healthBar.barImage.enabled = true;

                        EditorUtility.SetDirty(targ.healthBarInformation[i].healthBar.barImage);
                    }
                }

                EditorGUILayout.EndVertical();
            }
        }
        EditorGUILayout.EndFadeGroup();

        EditorGUILayout.Space();

        Repaint();
    }
Exemplo n.º 32
0
        private void IntegralClick(object sender, RoutedEventArgs e)
        {
            try
            {
                if (((CheckBox)sender).IsChecked == false)
                    return;

                var path = Directory.GetCurrentDirectory();
                var file = File.ReadAllText(path + SchemePath + FileName);

                var enable = ObsFunctionList.First(t => t.ID == (int) ((CheckBox) sender).Tag).IsNotDerivative;

                string function = "";

                if (enable == false)
                    function = string.Format("(derivativeFunc {0} {1} {2} {3})", XMin, XMax, DataPoints, CodeBox.Text);
                else
                    function = string.Format("(linearFunc {0} {1} {2} {3})", XMin, XMax, DataPoints, CodeBox.Text);

                var dataString = string.Format(file + function);
                dynamic data = SchemeCalculation(dataString);

                LineSeries dataline = CreateFunction(data, LineStyle.Solid, new AreaSeries());

                var serie = new AreaSeries();

                serie.Points.Add(new DataPoint(XMin, 0));
                foreach (var dataPoint in dataline.Points)
                {
                    serie.Points.Add(new DataPoint(dataPoint.X, dataPoint.Y));
                }
                serie.Points.Add(new DataPoint(XMax, 0));

                var functionList = new FunctionList()
                {
                    Function = serie,
                    Name = "integral",
                    SchemeFunction = function,
                    IsNotDerivative = false,
                    IsNotIntegral = false,
                    IsChecked = true,
                };

                if (functionList.Function == null)
                    return;

                functionList.ID = _idCounter++;
                AddFunctionToPlot(functionList);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Sorry to bother you!");
            }
        }
Exemplo n.º 33
0
 static IEnumerable<UIStateUpdate> GetUpdates(FunctionList oldState, FunctionList newState)
 {
     // We generate intermediate states (!?)
     if (oldState.FormulaEditWindow != newState.FormulaEditWindow)
     {
         // Always changes together with Move ...?
         var tempState = oldState.WithFormulaEditWindow(newState.FormulaEditWindow);
         yield return new UIStateUpdate(oldState, tempState, UIStateUpdate.UpdateType.FormulaEditWindowChange);
         oldState = (FunctionList)tempState;
     }
     if (oldState.FunctionListWindow != newState.FunctionListWindow)
     {
         Debug.Print(">>>>> Unexpected FunctionListWindowChange");  // Should never change???
         var tempState = oldState.WithFunctionListWindow(newState.FunctionListWindow);
         yield return new UIStateUpdate(oldState, tempState, UIStateUpdate.UpdateType.FunctionListWindowChange);
         oldState = tempState;
     }
     if (oldState.EditWindowBounds != newState.EditWindowBounds)
     {
         var tempState = oldState.WithBounds(newState.EditWindowBounds);
         yield return new UIStateUpdate(oldState, tempState, UIStateUpdate.UpdateType.FormulaEditMove);
         oldState = (FunctionList)tempState;
     }
     if (oldState.ExcelToolTipWindow != newState.ExcelToolTipWindow)
     {
         var tempState = oldState.WithToolTipWindow(newState.ExcelToolTipWindow);
         yield return new UIStateUpdate(oldState, tempState, UIStateUpdate.UpdateType.FormulaEditExcelToolTipChange);
         oldState = (FunctionList)tempState;
     }
     if (oldState.FormulaPrefix != newState.FormulaPrefix)
     {
         var tempState = oldState.WithFormulaPrefix(newState.FormulaPrefix);
         yield return new UIStateUpdate(oldState, tempState, UIStateUpdate.UpdateType.FormulaEditTextChange);
         oldState = (FunctionList)tempState;
     }
     if (oldState.SelectedItemText != newState.SelectedItemText ||
         oldState.SelectedItemBounds != newState.SelectedItemBounds ||
         oldState.FunctionListBounds != newState.FunctionListBounds)
     {
         yield return new UIStateUpdate(oldState, newState, UIStateUpdate.UpdateType.FunctionListSelectedItemChange);
     }
 }
Exemplo n.º 34
0
        public ActionResult MiniAppSaveMoneySetManager(int appId, int?projectType = null, int?pageType = null)
        {
            if (dzaccount == null)
            {
                return(Json(new { isok = false, msg = "系统繁忙auth_null!" }, JsonRequestBehavior.AllowGet));
            }
            XcxAppAccountRelation app = XcxAppAccountRelationBLL.SingleModel.GetModelByaccountidAndAppid(appId, dzaccount.Id.ToString());

            if (app == null)
            {
                return(Json(new { isok = false, msg = "系统繁忙null!" }, JsonRequestBehavior.AllowGet));
            }
            XcxTemplate _tempLate = XcxTemplateBLL.SingleModel.GetModel(app.TId);

            if (_tempLate == null)
            {
                return(Json(new { isok = false, msg = "系统繁忙tempLate_null!" }, JsonRequestBehavior.AllowGet));
            }

            int saveMoneySwtich = 0;//储值开关
            int versionId       = 0;

            if (_tempLate.Type == (int)TmpType.小程序专业模板)
            {
                FunctionList functionList = new FunctionList();
                versionId    = app.VersionId;
                functionList = FunctionListBLL.SingleModel.GetModel($"TemplateType={_tempLate.Type} and VersionId={versionId}");
                if (functionList == null)
                {
                    return(View("PageError", new Return_Msg()
                    {
                        Msg = "功能权限未设置!", code = "500"
                    }));
                }
                if (!string.IsNullOrEmpty(functionList.ProductMgr))
                {
                    OperationMgr operationMgr = JsonConvert.DeserializeObject <OperationMgr>(functionList.OperationMgr);
                    saveMoneySwtich = operationMgr.SaveMoney;
                }
            }
            string souceFrom = Context.GetRequest("SouceFrom", string.Empty);

            ViewBag.SouceFrom       = souceFrom;
            ViewBag.saveMoneySwtich = saveMoneySwtich;
            ViewBag.versionId       = versionId;

            bool canSaveMoneyFunction = true;

            switch (_tempLate.Type)
            {
            case (int)TmpType.小程序电商模板:
                Store store = StoreBLL.SingleModel.GetModel($"appId={appId}");
                if (store == null)
                {
                    return(Json(new { isok = false, msg = "系统繁忙store_null!" }, JsonRequestBehavior.AllowGet));
                }
                try
                {
                    store.funJoinModel = JsonConvert.DeserializeObject <StoreConfigModel>(store.configJson);
                }
                catch (Exception)
                {
                    store.funJoinModel = new StoreConfigModel();
                }
                canSaveMoneyFunction = store.funJoinModel.canSaveMoneyFunction;
                break;

            case (int)TmpType.小程序餐饮模板:
                Food food = FoodBLL.SingleModel.GetModel($"appId={appId}");
                if (food == null)
                {
                    return(Json(new { isok = false, msg = "系统繁忙store_null!" }, JsonRequestBehavior.AllowGet));
                }
                canSaveMoneyFunction = food.funJoinModel.canSaveMoneyFunction;
                break;

            case (int)TmpType.小程序专业模板:
                EntSetting ent = EntSettingBLL.SingleModel.GetModel($"aid={appId}");
                if (ent == null)
                {
                    return(Json(new { isok = false, msg = "系统繁忙store_null!" }, JsonRequestBehavior.AllowGet));
                }

                canSaveMoneyFunction = ent.funJoinModel.canSaveMoneyFunction;
                break;

            case (int)TmpType.小程序足浴模板:
                FootBath footbath = FootBathBLL.SingleModel.GetModel($"appId={appId}");
                if (footbath == null)
                {
                    return(Json(new { isok = false, msg = "系统繁忙store_null!" }, JsonRequestBehavior.AllowGet));
                }
                footbath.switchModel = JsonConvert.DeserializeObject <SwitchModel>(footbath.SwitchConfig);
                canSaveMoneyFunction = footbath.switchModel.canSaveMoneyFunction;
                break;

            case (int)TmpType.小程序多门店模板:
                FootBath multiStore = FootBathBLL.SingleModel.GetModel($"appId={appId} and HomeId = 0 ");
                if (multiStore == null)
                {
                    return(Json(new { isok = false, msg = "系统繁忙store_null!" }, JsonRequestBehavior.AllowGet));
                }
                multiStore.switchModel = JsonConvert.DeserializeObject <SwitchModel>(multiStore.SwitchConfig) ?? new SwitchModel();
                canSaveMoneyFunction   = multiStore.switchModel.canSaveMoneyFunction;
                break;

            case (int)TmpType.小未平台子模版:
                PlatStore platStore = PlatStoreBLL.SingleModel.GetPlatStore(app.Id, 2);

                if (platStore == null)
                {
                    return(Json(new { isok = false, msg = "店铺不存在!" }, JsonRequestBehavior.AllowGet));
                }
                PlatStoreSwitchModel switchModel = new PlatStoreSwitchModel();

                if (!string.IsNullOrEmpty(platStore.SwitchConfig))
                {
                    switchModel = Newtonsoft.Json.JsonConvert.DeserializeObject <PlatStoreSwitchModel>(platStore.SwitchConfig);
                }
                canSaveMoneyFunction = switchModel.SaveMoneyPay;
                break;
            }

            ViewBag.canSaveMoneyFuntion = canSaveMoneyFunction;
            ViewBag.appId = appId;
            if (projectType.HasValue)
            {
                ViewBag.typeId = projectType.Value;
            }
            if (pageType.HasValue)
            {
                ViewBag.typeId = pageType.Value;
            }

            return(View());
        }