示例#1
0
    public static bool BeginQuery(Contextual contextual)
    {
        NetEntityID netEntityID;

        if (!Context.self)
        {
            Debug.LogWarning("Theres no instance", Context.self);
        }
        else if (Context.ui._clientState != ContextClientState.Off)
        {
            Debug.LogWarning("Client is already in a context menu. Wait", contextual);
        }
        else if (!contextual)
        {
            Debug.LogWarning("null", Context.self);
        }
        else if (contextual.exists)
        {
            Facepunch.MonoBehaviour monoBehaviour = contextual.implementor;
            if ((int)NetEntityID.Of(contextual, out netEntityID) != 0)
            {
                Context.ui.OnServerQuerySent(monoBehaviour, netEntityID);
                return(true);
            }
            Debug.LogWarning("requestable has no network view", monoBehaviour);
        }
        else
        {
            Debug.LogWarning("requestable destroyed or did not implement monobehaviour", Context.self);
        }
        return(false);
    }
示例#2
0
 public static bool BeginQuery(Contextual contextual)
 {
     if (self == null)
     {
         Debug.LogWarning("Theres no instance", self);
     }
     else if (ui._clientState != ContextClientState.Off)
     {
         Debug.LogWarning("Client is already in a context menu. Wait", contextual);
     }
     else if (contextual == null)
     {
         Debug.LogWarning("null", self);
     }
     else if (!contextual.exists)
     {
         Debug.LogWarning("requestable destroyed or did not implement monobehaviour", self);
     }
     else
     {
         NetEntityID   yid;
         MonoBehaviour implementor = contextual.implementor;
         if (((int)NetEntityID.Of((MonoBehaviour)contextual, out yid)) == 0)
         {
             Debug.LogWarning("requestable has no network view", implementor);
         }
         else
         {
             ui.OnServerQuerySent(implementor, yid);
             return(true);
         }
     }
     return(false);
 }
示例#3
0
 private Expression ParseKeyword_DO(string Keyword)
 {
     if (!INTERCATIVE)
     {
         var snap      = ExpressionTypeBeam.TakeSnapshot();
         var @break    = Expression.Label("break");
         var @continue = Expression.Label("continue");
         Contextual.Push(Expression.Goto(@break));
         Contextual.Push(Expression.Goto(@continue));
         List <Expression> Instruction = new List <Expression>();
         Instruction.Add(Expression.Label(@continue));
         Instruction.AddRange(ParseBlock(true));
         LineNumber--;
         if (Peek(5).ToUpper() != "UNTIL")
         {
             throw new AutoitException(AutoitExceptionType.EXPECTUNTIL, LineNumber, Cursor, Getstr(Reg_AlphaNum));
         }
         Consume(5);
         ConsumeWS();
         var Cond = Expression.Not(ParseBoolean(false).ConvertTo(typeof(bool)));
         //Instruction.AddRange(VarSynchronisation);
         //VarSynchronisation.Clear();
         Instruction.Add(Expression.IfThen(Cond, Expression.Goto(@continue)));
         Instruction.Add(Expression.Label(@break));
         Instruction.Add(ExpressionTypeBeam.RestoreSnapshot(snap));
         Contextual.Pop();
         Contextual.Pop();
         return(Expression.Block(Instruction.ToArray()));
     }
     else
     {
         throw new AutoitException(AutoitExceptionType.MULTILINEININTERACTIVE, LineNumber, Cursor, Keyword);
     }
 }
示例#4
0
        public override T get <T>(Contextual <T> contextual)
        {
            Bean <T> bean         = (Bean <T>)contextual;
            string   variableName = bean.Name;

            BusinessProcess businessProcess = BusinessProcess;
            object          variable        = businessProcess.getVariable(variableName);

            if (variable != null)
            {
                if (logger.isLoggable(Level.FINE))
                {
                    if (businessProcess.Associated)
                    {
                        logger.fine("Getting instance of bean '" + variableName + "' from Execution[" + businessProcess.ExecutionId + "].");
                    }
                    else
                    {
                        logger.fine("Getting instance of bean '" + variableName + "' from transient bean store");
                    }
                }

                return((T)variable);
            }
            else
            {
                return(null);
            }
        }
示例#5
0
        private Expression ParseKeyword_RETURN(string Keyword)
        {
            return(Expression.Block(Contextual.Peek().Type,
                                    VarAutExpression.VariableAccess("Return-store").Setter(ParseBoolean(false).ConvertTo(Contextual.Peek().Type))
                                    , Contextual.Peek()));

            /*VarSynchronisation.Add();
            *  return Contextual.Peek();*/
        }
        //protected CompileFuncDelegate CompileFunc;
        public void LiCompileFunction()
        {
            foreach (var ID in FunctionIdentifiers)
            {
                GotoLine(ID.Key);
                var FMeta = GetFunctionMeta();
                NextLine();
                var Ret = Expression.Label();
                Contextual.Push(Expression.Goto(Ret, FMeta.ReturnType));
                ExpressionTypeBeam.PushScope();
                foreach (var arg in FMeta.Parameters)
                {
                    ExpressionTypeBeam.CurrentScope.SetVarCached(arg.Name, Expression.Constant(arg.ArgType.DefaultValue(), arg.ArgType), false);
                }
                ExpressionTypeBeam.CurrentScope.DefineFunc(ID.Value, Expression.Lambda(ParseBlock(), ExpressionTypeBeam.PopScope()));
            }

            /*
             * return;
             * var Matches = Script.Where(x => Regex.IsMatch(x, "^(?:\t| )*func(.*?)$", RegexOptions.IgnoreCase)).ToList();
             * var Lines = Matches.Select(x => Array.IndexOf(Script, x));
             * List<ParameterExpression> Params = new List<ParameterExpression>();
             * foreach (var L in Lines)
             * {
             *  GotoLine(L);
             *  var FMeta = GetFunctionMeta();
             *  ExpressionTypeBeam.PushScope();
             *  List<Expression> PreFunction = new List<Expression>();
             *
             *  var MyFunc = ExpressionTypeBeam.CurrentScope.Parent.ScopeFunctions.First(x => x.Name == FMeta.Name && x.Parameters.SequenceEqual(FMeta.Parameters) && x.ReturnType == FMeta.ReturnType);
             *
             *  PreFunction.Add(VarAutExpression.VariableAccess("Return-store", false)
             *      .Setter(Expression.Constant(FMeta.ReturnType.DefaultValue(), FMeta.ReturnType)));
             *  PreFunction.AddRange(
             *      MyFunc.Parameters.Select(x =>
             *      {
             *          var PType = x.GetTypeInfo().IsValueType ? typeof(Nullable<>).MakeGenericType(x) : x;
             *          Params.Add(Expression.Parameter(PType));
             *          return VarAutExpression.VariableAccess(x.ArgName).Setter(
             *              Expression.Coalesce(Params.Last(), x.DefaultValue().ConvertTo(x))
             *          );
             *      })
             *  );
             *  var Ret = Expression.Label();
             *  Contextual.Push(Expression.Goto(Ret, FMeta.ReturnType));
             *
             *  var Block = ParseBlock();
             *
             *  Block.Add(Expression.Label(Ret));
             *  Block.Add(VarAutExpression.VariableAccess("Return-store", false).Getter(L.FDef.ReturnType));
             *  ExpressionTypeBeam.CurrentScope.DefineFunc(, Expression.Lambda(Expression.Block(ExpressionTypeBeam.PopScope(), Block), Params));
             *  Block.Clear();
             *  Params.Clear();
             * }*/
        }
示例#7
0
    private bool SearchForContextRequestable(out UnityEngine.MonoBehaviour impl)
    {
        Contextual contextual;

        if (Contextual.FindUp(base.transform, out contextual))
        {
            Facepunch.MonoBehaviour   monoBehaviour  = contextual.implementor;
            UnityEngine.MonoBehaviour monoBehaviour1 = monoBehaviour;
            impl = monoBehaviour;
            if (monoBehaviour1)
            {
                return(true);
            }
        }
        impl = null;
        return(false);
    }
示例#8
0
        public override T get <T>(Contextual <T> contextual, CreationalContext <T> arg1)
        {
            Bean <T> bean         = (Bean <T>)contextual;
            string   variableName = bean.Name;

            BusinessProcess businessProcess = BusinessProcess;
            object          variable        = businessProcess.getVariable(variableName);

            if (variable != null)
            {
                if (logger.isLoggable(Level.FINE))
                {
                    if (businessProcess.Associated)
                    {
                        logger.fine("Getting instance of bean '" + variableName + "' from Execution[" + businessProcess.ExecutionId + "].");
                    }
                    else
                    {
                        logger.fine("Getting instance of bean '" + variableName + "' from transient bean store");
                    }
                }

                return((T)variable);
            }
            else
            {
                if (logger.isLoggable(Level.FINE))
                {
                    if (businessProcess.Associated)
                    {
                        logger.fine("Creating instance of bean '" + variableName + "' in business process context representing Execution[" + businessProcess.ExecutionId + "].");
                    }
                    else
                    {
                        logger.fine("Creating instance of bean '" + variableName + "' in transient bean store");
                    }
                }

                T beanInstance = bean.create(arg1);
                businessProcess.setVariable(variableName, beanInstance);
                return(beanInstance);
            }
        }
示例#9
0
        private Expression ParseKeyword_WHILE(string Keyword)
        {
            var Element = ParseBoolean(false).ConvertTo(typeof(bool));
            var snap    = ExpressionTypeBeam.TakeSnapshot();

            ConsumeWS();
            if (!EOL)
            {
                var @break    = Expression.Label();
                var @continue = Expression.Label();
                return(Expression.Block(
                           Expression.Label(@continue),
                           Expression.IfThen(Expression.Not(Element), Expression.Goto(@break)),
                           ParseBoolean(),
                           Expression.Goto(@continue),
                           Expression.Label(@break)));
            }
            else if (!INTERCATIVE)
            {
                var @break    = Expression.Label("break");
                var @continue = Expression.Label("continue");
                Contextual.Push(Expression.Goto(@break));
                Contextual.Push(Expression.Goto(@continue));
                List <Expression> Instruction = new List <Expression>();
                Instruction.Add(Expression.Label(@continue));
                Instruction.Add(Expression.IfThen(Expression.Not(Element), Expression.Goto(@break)));
                Instruction.AddRange(ParseBlock(true));
                Instruction.Add(Expression.Goto(@continue));
                Instruction.Add(Expression.Label(@break));
                Instruction.Add(ExpressionTypeBeam.RestoreSnapshot(snap));
                Contextual.Pop();
                Contextual.Pop();
                return(Expression.Block(Instruction.ToArray()));
            }
            else
            {
                throw new AutoitException(AutoitExceptionType.MULTILINEININTERACTIVE, LineNumber, Cursor, Keyword);
            }
        }
示例#10
0
    private bool ClientCheckUse(Ray ray, bool press)
    {
        RaycastHit hit;

        Facepunch.MonoBehaviour implementor;
        if (Physics.Raycast(ray, out hit, this.raycastLength, -201523205))
        {
            UnityEngine.MonoBehaviour behaviour2;
            NetEntityID      yid;
            NetEntityID.Kind kind;
            Transform        component = hit.transform;
            for (Transform transform2 = component.parent; (((int)(kind = NetEntityID.Of(component, out yid, out behaviour2))) == 0) && (transform2 != null); transform2 = component.parent)
            {
                component = transform2;
            }
            if (((int)kind) == 0)
            {
                implementor = null;
            }
            else
            {
                Contextual contextual;
                if (Contextual.ContextOf(behaviour2, out contextual))
                {
                    implementor = contextual.implementor;
                    if (press)
                    {
                        Context.BeginQuery(contextual);
                    }
                }
                else
                {
                    implementor = null;
                }
            }
        }
        else
        {
            implementor = null;
        }
        if (implementor != this.lastUseHighlight)
        {
            this.lastUseHighlight = implementor;
            if (implementor != null)
            {
                IContextRequestableText text = implementor as IContextRequestableText;
                if (text != null)
                {
                    RPOS.UseHoverTextSet(base.controllable, text);
                }
                else
                {
                    RPOS.UseHoverTextSet(implementor.name);
                }
            }
            else
            {
                RPOS.UseHoverTextClear();
            }
        }
        return((bool)implementor);
    }
 public void LetObserverWatch(Contextual.DocumentEditViewModel documentEditViewModel)
 {
     foreach (var observer in registeredObservers)
         observer.ReceiveDocumentEditViewModel(documentEditViewModel);
 }
示例#12
0
        private Expression ParseKeyword_FOR(string Keyword)
        {
            Expression InitVal, LastVal, Step;
            string     ForVarName;

            ForVarName = (ParsePrimary() as VarAutExpression).Name;
            ConsumeWS();
            if (Peek(1).ToUpper() != "=")
            {
                throw new AutoitException(AutoitExceptionType.FORWITHOUTTO, LineNumber, Cursor);
            }
            Consume(); ConsumeWS();
            InitVal = ParseBoolean().ConvertToNumber();
            ConsumeWS();
            if (Peek(2).ToUpper() != "TO")
            {
                throw new AutoitException(AutoitExceptionType.FORWITHOUTTO, LineNumber, Cursor);
            }
            Consume(2); ConsumeWS();
            LastVal = ParseBoolean().ConvertTo(InitVal.Type);
            ConsumeWS();
            if (Peek(4).ToUpper() == "STEP")
            {
                Consume(4); ConsumeWS();
                Step = ParseBoolean().ConvertTo(InitVal.Type);
            }
            else
            {
                Step = Expression.Constant(1, typeof(int)).ConvertTo(InitVal.Type);
            }
            if (!INTERCATIVE)
            {
                var @break    = Expression.Label("break");
                var @continue = Expression.Label("continue");
                var @DownTo   = VarAutExpression.VariableAccess("downto-" + Contextual.Count, false);
                var @LoopVar  = VarAutExpression.VariableAccess(ForVarName, false);
                Contextual.Push(Expression.Goto(@break));
                Contextual.Push(Expression.Goto(@continue));
                List <Expression> Instruction = new List <Expression>();
                if (Step is ConstantExpression)
                {
                    Instruction.Add(@DownTo.Setter((ConstantExpression)Expression.Constant((dynamic)(Step as ConstantExpression).Value < 0, typeof(bool))));
                }
                else
                {
                    Instruction.Add(@DownTo.Setter(Expression.LessThan(Step, Expression.Constant(0, InitVal.Type))));
                }
                Instruction.Add(@LoopVar.Setter(InitVal));
                Instruction.Add(Expression.Label(@continue));
                Instruction.Add(Expression.IfThen(
                                    Expression.OrElse(
                                        Expression.AndAlso(
                                            @DownTo.Getter(typeof(bool)),
                                            Expression.LessThan(@LoopVar.Getter(InitVal.Type), LastVal)),
                                        Expression.AndAlso(
                                            Expression.Not(@DownTo.Getter(typeof(bool))),
                                            Expression.GreaterThan(@LoopVar.Getter(InitVal.Type), LastVal)))
                                    , Expression.Goto(@break)));
                Instruction.AddRange(ParseBlock(true));
                Instruction.Add(Expression.Assign(
                                    @LoopVar.Getter(InitVal.Type),
                                    Expression.Add(@LoopVar.Getter(InitVal.Type), Step)));
                Instruction.Add(Expression.Goto(@continue));
                Instruction.Add(Expression.Label(@break));
                Contextual.Pop();
                Contextual.Pop();
                return(Expression.Block(Instruction.ToArray()));
            }
            else
            {
                throw new AutoitException(AutoitExceptionType.MULTILINEININTERACTIVE, LineNumber, Cursor, Keyword);
            }
        }
        public void ReceiveCloseArticleControl(Contextual.CustomerEditViewModel customerEditViewModel)
        {
            //We need to change the visibility due to a bug in the RibbonControl which shows the contextual TabHeader after removing a visible item
            customerEditViewModel.RibbonTabItem.Visibility = System.Windows.Visibility.Collapsed;

            ParentViewModel.RibbonFactory.RemoveTabItem(customerEditViewModel.RibbonTabItem);
            RibbonTabItem.IsSelected = true;
        }
        /// <summary>
        /// Closes a specified <see cref="ArticleEditViewModel"/>.
        /// </summary>
        /// <param name="articleEditViewModel"></param>
        public void ReceiveCloseArticleControl(Contextual.ArticleEditViewModel articleEditViewModel)
        {
            //We need to change the visibility during a bug in the RibbonControl which shows the contextual TabHeader after removing a visible item
            articleEditViewModel.RibbonTabItem.Visibility = System.Windows.Visibility.Collapsed;

            ParentViewModel.RibbonFactory.RemoveTabItem(articleEditViewModel.RibbonTabItem);
            RibbonTabItem.IsSelected = true;
            ViewModelRequestingArticle = null;
        }
示例#15
0
 public static bool BeginQuery(Contextual contextual)
 {
     NetEntityID netEntityID;
     if (!Context.self)
     {
         Debug.LogWarning("Theres no instance", Context.self);
     }
     else if (Context.ui._clientState != ContextClientState.Off)
     {
         Debug.LogWarning("Client is already in a context menu. Wait", contextual);
     }
     else if (!contextual)
     {
         Debug.LogWarning("null", Context.self);
     }
     else if (contextual.exists)
     {
         Facepunch.MonoBehaviour monoBehaviour = contextual.implementor;
         if ((int)NetEntityID.Of(contextual, out netEntityID) != 0)
         {
             Context.ui.OnServerQuerySent(monoBehaviour, netEntityID);
             return true;
         }
         Debug.LogWarning("requestable has no network view", monoBehaviour);
     }
     else
     {
         Debug.LogWarning("requestable destroyed or did not implement monobehaviour", Context.self);
     }
     return false;
 }
示例#16
0
    private bool ClientCheckUse(Ray ray, bool press)
    {
        RaycastHit raycastHit;

        Facepunch.MonoBehaviour   monoBehaviour;
        UnityEngine.MonoBehaviour monoBehaviour1;
        NetEntityID netEntityID;

        NetEntityID.Kind kind;
        Contextual       contextual;

        if (!Physics.Raycast(ray, out raycastHit, this.raycastLength, -201523205))
        {
            monoBehaviour = null;
        }
        else
        {
            Transform transforms  = raycastHit.transform;
            Transform transforms1 = transforms.parent;
            while (true)
            {
                NetEntityID.Kind kind1 = NetEntityID.Of(transforms, out netEntityID, out monoBehaviour1);
                kind = kind1;
                if ((int)kind1 != 0 || !transforms1)
                {
                    break;
                }
                transforms  = transforms1;
                transforms1 = transforms.parent;
            }
            if ((int)kind == 0)
            {
                monoBehaviour = null;
            }
            else if (!Contextual.ContextOf(monoBehaviour1, out contextual))
            {
                monoBehaviour = null;
            }
            else
            {
                monoBehaviour = contextual.implementor;
                if (press)
                {
                    Context.BeginQuery(contextual);
                }
            }
        }
        if (monoBehaviour != this.lastUseHighlight)
        {
            this.lastUseHighlight = monoBehaviour;
            if (!monoBehaviour)
            {
                RPOS.UseHoverTextClear();
            }
            else
            {
                IContextRequestableText contextRequestableText = monoBehaviour as IContextRequestableText;
                if (contextRequestableText == null)
                {
                    RPOS.UseHoverTextSet(monoBehaviour.name);
                }
                else
                {
                    RPOS.UseHoverTextSet(base.controllable, contextRequestableText);
                }
            }
        }
        return(monoBehaviour);
    }