Example #1
0
        public override ElementCollection EnterElements(string prompt = "Enter elements")
        {
            GetObject gO = new GetObject();

            gO.SetCustomGeometryFilter(new GetObjectGeometryFilter(FilterHandles));
            //gO.GeometryFilter = ObjectType.Curve;
            gO.SetCommandPrompt(prompt);
            if (gO.GetMultiple(1, 0) == GetResult.Cancel)
            {
                throw new OperationCanceledException("Operation cancelled by user");
            }
            var result = new ElementCollection();

            foreach (ObjRef rObj in gO.Objects())
            {
                if (Host.Instance.Handles.Links.ContainsSecond(rObj.ObjectId))
                {
                    Guid guid = Host.Instance.Handles.Links.GetFirst(rObj.ObjectId);

                    ElementTable elementTable = Core.Instance.ActiveDocument?.Model?.Elements;
                    if (elementTable != null && elementTable.Contains(guid))
                    {
                        Element element = Core.Instance.ActiveDocument?.Model?.Elements[guid];
                        if (element != null)
                        {
                            result.Add(element);
                        }
                    }
                }
            }
            return(result);
        }
/* Regex patterns
 *      AspCodeRegex : \G<%(?!@)(?<code>.*?)%>
 *      AspExprRegex : \G<%\s*?=(?<code>.*?)?%>
 *      CommentRegex : \G<%--(([^-]*)-)*?-%>
 *      DataBindExprRegex : \G<%#(?<code>.*?)?%>
 *      DirectiveRegex : \G<%\s*@(\s*(?<attrname>\w+(?=\W))(\s*(?<equal>=)\s*"(?<attrval>[^"]*)"|\s*(?<equal>=)\s*'(?<attrval>[^']*)'|\s*(?<equal>=)\s*(?<attrval>[^\s%>]*)|(?<equal>)(?<attrval>\s*?)))*\s*?%>
 *      EndTagRegex : \G</(?<tagname>[\w:\.]+)\s*>
 *      GTRegex : [^%]>
 *      IncludeRegex : \G<!--\s*#(?i:include)\s*(?<pathtype>[\w]+)\s*=\s*["']?(?<filename>[^\"']*?)["']?\s*-->
 *      LTRegex : <
 *      RunATServerRegex : runat\W*server
 *      ServerTagsRegex : <%(?!#)(([^%]*)%)*?>
 *      TagRegex : \G<(?<tagname>[\w:\.]+)(\s+(?<attrname>[-\w]+)(\s*=\s*"(?<attrval>[^"]*)"|\s*=\s*'(?<attrval>[^']*)'|\s*=\s*(?<attrval><%#.*?%>)|\s*=\s*(?<attrval>[^\s=/>]*)|(?<attrval>\s*?)))*\s*(?<empty>/)?>
 *      TextRegex : \G[^<]+
 *
 *      //SimpleDirectiveRegex simpleDirectiveRegex = new SimpleDirectiveRegex();
 */
        static SimpleParser()
        {
            _unclosedTagRegex      = new Regex(_pattern, _options);
            _endTagOptionalElement = new ElementTable();

            /* following defnitions from MSDN Online WorkShop
             *  http://msdn.microsoft.com/workshop/c-frame.htm#/workshop/author/default.asp
             */
            _endTagOptionalElement.AddRange(
                new String[] {
                "area", "base", "basefront", "bgsound", "br",
                "col", "colgroup", "dd", "dt", "embed", "frame",
                "hr", "img", "input", "isindex", "li", "link",
                "meta", "option", "p", "param", "rt"
            });
        }
Example #3
0
 public void AddCellsGround(int[][] Cells)
 {
     for (int i = 0; i < Cells.Length; i++)
     {
         for (int j = 0; j < Cells[i].Length; j++)
         {
             if (Cells[i][j] != 0)
             {
                 ElementTable eTable = TableData.PSceneEleTableInfo.Get(Cells[i][j]);
                 ResourceManager.CreateSceneElemt(eTable.ArtResource1, delegate(UnityEngine.Object obj)
                 {
                     GameObject go = obj as GameObject;
                     Move(go, new Vector2(i, j));
                 });
             }
         }
     }
 }
    private byte AttachFullRuleSet(byte[] buf)
    {
        //Get the players on that server
        ElementTable pt = this.client.server.MySQL.FetchPlayers(gServer.InternalId, this.client.server.Config.PlayerTimeout);

        //Push the playertable onto the serverparams
        if (pt != null)
        {
            gServer.DynamicStorage.AttachDataTable(pt);
        }

        //Attach every server-property
        foreach (DataPair field in gServer.DynamicStorage.FieldList)
        {
            ConcatArray(ArrayFunctions.GetBytes(field.varName), buf, 0);
            ConcatArray(ArrayFunctions.GetBytes(field.value), buf, 0);
        }
    }
Example #5
0
        private FileCodeModel(
            CodeModelState state,
            object parent,
            DocumentId documentId,
            ITextManagerAdapter textManagerAdapter)
            : base(state)
        {
            Debug.Assert(documentId != null);
            Debug.Assert(textManagerAdapter != null);

            _parentHandle       = new ComHandle <object, object>(parent);
            _documentId         = documentId;
            _textManagerAdapter = textManagerAdapter;

            _elementTable = new ElementTable();

            _batchMode      = false;
            _batchDocument  = null;
            _lastSyntaxTree = GetSyntaxTree();
        }
    void Awake()
    {
        ElementTable.Setup();

        this.GetComponent <TweenHelper>().test   = null;
        this.GetComponent <TweenHelper>().testV3 = null;

        calculatedRoute = new List <GameObject>();
        openList        = new Queue <AStarNode>();
        closedList      = new Queue <AStarNode>();
        aStarResult     = new Queue <GameObject>();

        from = ElementTable.GetRandomSource(this.gameObject);
        to   = ElementTable.GetRandomDestination();

        crossMetaObject = GameObject.FindObjectsOfType <CrossRoadMeta>();

        PlaceCarToStartingPoint(from);
        FindShortestPath(from, to);
    }
Example #7
0
    public void OnClickCompoundButton()
    {
        if (!IsCompoundable())
        {
            return;
        }

        // Using
        int requireProtonNum   = CalculateProtonNumber(ElementNumber);
        int requireNeutronNum  = CalculateNeutronNumber(ElementNumber);
        int requireElectronNum = CalculateElectronNumber(ElementNumber);

        InventoryManager.proton   -= requireProtonNum;
        InventoryManager.neutron  -= requireNeutronNum;
        InventoryManager.electron -= requireElectronNum;

        string msg = string.Format("양성자 {0}개, 중성자 {1}개, 전자 {2}개 소모", requireProtonNum, requireNeutronNum, requireElectronNum);

        // Lotto!
        double prob = CalculateCompoundSuccessProbability(this.ElementNumber);

        if (Random.Range(0.0f, 1.0f) <= prob)
        {
            // Success
            msg = string.Format("조합 성공! - {0}", msg);

            // Unlock
            InventoryManager.Element [this.ElementNumber - 1] = true;
        }
        else
        {
            // Fail
            msg = string.Format("조합 실패! - {0}", msg);
        }
        Status.text = msg;
        UpdateLabels();
        ElementTable.Inst().ElementTableUpdate();
    }
Example #8
0
    public void FindMyNeighbours()
    {
        CrossRoadMeta     meta    = this.GetComponentInParent <CrossRoadMeta>();
        List <GameObject> options = new List <GameObject>();
        bool isFrom = false;

        foreach (var item in meta.roadGroup)
        {
            if (GameObject.ReferenceEquals(this.gameObject, item.from))
            {
                isFrom  = true;
                options = item.options;
            }
        }

        if (isFrom)
        {
            foreach (var item in options)
            {
                //Debug.Log("crossroadban vagyok, ez egy from elem; szülő: " + this.transform.parent);

                if (item.GetComponent <CrossRoadModel>().ClosestRoad == null)
                {
                    GameObject myNeighbourForward = ElementTable.MyClosestNeighbour(item, item.transform.forward * 5);
                    item.GetComponent <CrossRoadModel>().ClosestRoad = myNeighbourForward;

                    RoadElementModel component = myNeighbourForward.GetComponent <RoadElementModel>();

                    if (component.PreviousElement == null)
                    {
                        component.PreviousElement = item;
                    }
                    component.FindMyNeighbours();
                }
            }
        }
    }
    public void FindMyNeighbours()
    {
        if (nextElement == null)
        {
            GameObject myNeighbourForward = ElementTable.MyClosestNeighbour(this.gameObject, this.transform.forward * 5);

            NextElement = myNeighbourForward;

            if (myNeighbourForward.tag.Equals("RoadModel"))
            {
                RoadElementModel component = myNeighbourForward.GetComponent <RoadElementModel>();

                if (component.PreviousElement == null)
                {
                    component.PreviousElement = this.gameObject;
                }
                component.FindMyNeighbours();
            }

            if (myNeighbourForward.tag.Equals("CrossRoad"))
            {
                CrossRoadModel component = myNeighbourForward.GetComponent <CrossRoadModel>();

                if (component.ClosestRoad == null)
                {
                    component.ClosestRoad = this.gameObject;
                }

                component.FindMyNeighbours();
            }
        }

        if (previousElement == null)
        {
            GameObject myNeighbourBackward = ElementTable.MyClosestNeighbour(this.gameObject, (-1) * this.transform.forward * 5);

            PreviousElement = myNeighbourBackward;

            if (myNeighbourBackward.tag.Equals("RoadModel"))
            {
                RoadElementModel component = myNeighbourBackward.GetComponent <RoadElementModel>();

                if (component.NextElement == null)
                {
                    component.NextElement = this.gameObject;
                }
                component.FindMyNeighbours();
            }

            if (myNeighbourBackward.tag.Equals("CrossRoad"))
            {
                CrossRoadModel component = myNeighbourBackward.GetComponent <CrossRoadModel>();

                if (component.ClosestRoad == null)
                {
                    component.ClosestRoad = this.gameObject;
                }

                component.FindMyNeighbours();
            }
        }
    }
        static SimpleParser()
        {
            _unclosedTagRegex = new Regex(_pattern, _options);
            _endTagOptionalElement = new ElementTable();

            /* following defnitions from MSDN Online WorkShop
                http://msdn.microsoft.com/workshop/c-frame.htm#/workshop/author/default.asp
            */
            _endTagOptionalElement.AddRange(
                new String[] {
                                 "area", "base", "basefront", "bgsound", "br",
                                 "col", "colgroup", "dd", "dt", "embed", "frame",
                                 "hr", "img", "input", "isindex", "li", "link",
                                 "meta", "option", "p", "param", "rt"
                             });
                             
        }
Example #11
0
        public GOST(String fileName)
        {
            StreamReader fs = new StreamReader(fileName);

            try
            {
                String   text   = fs.ReadToEnd();
                String[] lines  = text.Split('\n');
                String[] fields = lines[1].Split(';');
                try
                {
                    GOSTIndex   = fields[0];
                    BaseElement = fields[1];
                    Description = fields[2];
                }
                catch (Exception ex)
                {
                    Log.OutNoMsg(ex);
                    throw ex;
                }
                String element = null;
                for (int i = 2; i < lines.Length; i++)
                {
                    ParseErrorCandidate = "File: " + fileName + " Line [" + lines[i] + "]";
                    fields = lines[i].Split(';');
                    String cand = fields[0].Replace(':', ' ').Trim();
                    if (cand.Length <= 2 && cand.Length > 0 && Char.IsLetter(cand[0]))
                    {
                        if (ElementTable.FindIndex(cand) < 0)
                        {
                            throw new Exception("Wrong name of element " + cand);
                        }
                        element = cand;
                    }
                    else
                    {
                        //for (; i < lines.Length; i++)
                        try
                        {
                            string[] lfields = lines[i].Split(';');
                            GOSTLine li;
                            if (lfields[0].Trim().Length > 0)
                            {
                                li = new GOSTLine(element, lfields, true, BaseElement);
                                LineInfo.Add(li);
                            }
                            //string[] lfields = lines[i].Split(';');
                            if (lfields[2].Trim().Length > 0)
                            {
                                li = new GOSTLine(element, lfields, false, BaseElement);
                                LineInfo.Add(li);
                            }
                        }
                        catch (Exception ex)
                        {
                            Log.OutNoMsg(ex);
                        }
                    }
                }
            }
            finally
            {
                fs.Close();
            }
        }