예제 #1
0
 internal static void SetVariable(string varName, INodeData value)
 {
     lock (Variables)
     {
         Variables[varName] = value;
     }
 }
예제 #2
0
        public List <Node> GetMooreNeighbours(INodeData middleNode)
        {
            List <Node> neighbours = new List <Node>();

            for (int y = -1; y <= 1; y++)
            {
                for (int x = -1; x <= 1; x++)
                {
                    if (x == 0 && y == 0)
                    {
                        continue;
                    }

                    int nodeX = middleNode.Data.x + x;
                    int nodeY = middleNode.Data.y + y;

                    if (IsInSection(nodeX, nodeY))
                    {
                        neighbours.Add(sectionGrid[nodeX, nodeY]);
                    }
                }
            }

            return(neighbours);
        }
예제 #3
0
 public override void Execute(object context)
 {
     if (conIn.IsConnected)
     {
         object newContext = new object(); // new exuction node, new execution context
         Value = conIn.AttachedConnections.Select(connection =>
         {
             try
             {
                 object tmp = connection.SourceConnector.ParentNode.GetValue(connection.SourceConnector, context);
                 if (typeof(INodeData).IsAssignableFrom(tmp.GetType()))
                 {
                     return((INodeData)tmp);
                 }
                 return(null);
             }
             catch
             {
                 return(null);
             }
         }).Where(val => val != null).FirstOrDefault();
     }
     else
     {
         Value = null;
     }
     OnPropertyChanged("Note");
 }
예제 #4
0
        internal void InjectDataIntoInstance(IList <INodeData> list, DeserializationContext context, ref object instance)
        {
            list = list[0].SubNodes[1].SubNodes;

            int propIndex = 0;
            int nodeIndex = -1;

            for (int i = 0; i < PropertiesCount; i++)
            {
                while (nodeIndex < list.Count)
                {
                    nodeIndex++;
                    if (!NodeUtils.IgnoreOnDeserialization(list[nodeIndex].Type))
                    {
                        break;
                    }
                }

                INodeData node = list[nodeIndex];

                /*
                 * if (node.Type == Parser.NodeType.COMMENT)
                 *  continue;
                 * if (node.Type == Parser.NodeType.SYMBOL)
                 *  continue;
                 */
                object val = Serializers[propIndex].DeserializeInternal(node.Data, context);

                PropertieSetter[i].Invoke(instance, val);

                propIndex++;
            }
        }
        private bool CanDeserialize(IList <INodeData> nodes, out Type type, out Metadata metadata, DeserializationContext context)
        {
            if (nodes[0].Type != NodeType.OBJECT)
            {
                type     = null;
                metadata = null;
                return(false);
            }

            INodeData typeNode = nodes[0].SubNodes[1].SubNodes.FirstOrDefault(n => n.Type == NodeType.METADATA);

            CustomSerializer serializer = new CustomSerializer(typeof(Metadata));

            metadata = (Metadata)serializer.ReadObjectData(new List <INodeData>()
            {
                typeNode
            }, context, -1);

            if (!CustomType.IsAssignableFrom(metadata.Type))
            {
                type = metadata.Type;
                return(false);
            }

            type = metadata.Type;
            return(true);
        }
예제 #6
0
        private void OnDataListener(string path, INodeData data)
        {
            AllianceHelpApplyInfo info = data as AllianceHelpApplyInfo;

            LTUIUtil.SetText(ResidueHelpNumLabel, LT.Hotfix.Utility.ColorUtility.FormatResidueStr(GetResidueHelpApplyCount(), VIPTemplateManager.Instance.GetTotalNum(VIPPrivilegeKey.EscortReinforceTimes)));

            Scroll.SetItemDatas(info.HelpApplyList.ToArray());
        }
예제 #7
0
 void OnNationListListener(string path, INodeData data)
 {
     if (!NationManager.Instance.List.Updated)
     {
         return;
     }
     NationManager.Instance.List.Updated = false;
 }
예제 #8
0
        void OnNationAccountListener(string path, INodeData data)
        {
            int           rTs     = 0;
            NationAccount account = data as NationAccount;

            if (account.TeamDataUpdated)
            {
                account.TeamDataUpdated = false;
                for (int i = 0; i < TeamItems.Length; ++i)
                {
                    TeamItems[i].Fill(account.TeamList[i]);
                    TeamItems[i].ctrl = this;
                    eTeamState state = account.TeamList[i].RealState;
                    if (state == eTeamState.Available || state == eTeamState.InTheWar)
                    {
                        //非复活状态
                        ReviveButton.gameObject.CustomSetActive(false);
                        TimeButton.gameObject.CustomSetActive(false);
                        isAllTeamDeath = false;
                    }
                }

                if (!isAllTeamDeath)
                {
                    return;
                }

                for (int i = 0; i < TeamItems.Length; i++)
                {
                    TeamItems[i].OffBtn.gameObject.CustomSetActive(false);
                    TeamItems[i].GoOnButton.gameObject.CustomSetActive(false);
                    TeamItems[i].Mask.gameObject.CustomSetActive(true);
                    if (TeamItems[i].TeamData.ReviveTs != -2)
                    {
                        rTs = TeamItems[i].TeamData.ReviveTs;
                    }
                }
                ReviveButton.gameObject.CustomSetActive(true);
                TimeButton.gameObject.CustomSetActive(true);
                LTUIUtil.SetText(ReviveCostLabel, NationManager.Instance.Config.TeamReviveCost.ToString());
                if (BalanceResourceUtil.GetUserDiamond() < NationManager.Instance.Config.TeamReviveCost)
                {
                    ReviveCostLabel.color = LT.Hotfix.Utility.ColorUtility.RedColor;
                }
                else
                {
                    ReviveCostLabel.color = LT.Hotfix.Utility.ColorUtility.WhiteColor;
                }
                if (ReviveCoroutine != null)
                {
                    StopCoroutine(ReviveCoroutine);
                }
                if (controller.gameObject.activeSelf)
                {
                    ReviveCoroutine = StartCoroutine(ReviveTimer(rTs));
                }
            }
        }
예제 #9
0
        private void ParserPass(int i)
        {
            var prop = stringBuilder.ToString();

            for (int p = 0; p < NodeParsers.Count; p++)
            {
                INodeParser parser = NodeParsers[p];

                IList <INodeData> nodes = null;

                int position = i - prop.Length;

                string patched;

                if (parser.IsValid(prop, out nodes, position, out patched))
                {
                    stringBuilder = new StringBuilder(patched);

                    for (int n = 0; n < nodes.Count; n++)
                    {
                        NodeDatas.Add(nodes[n]);

                        for (int i1 = 0; i1 < nodes[n].SubNodes.Count; i1++)
                        {
                            INodeData sub = nodes[n].SubNodes[i1];
                            if (!NodeUtils.IsTerminal(sub.Type))
                            {
                                IList <INodeData> subnodes;

                                var mainParser = new MainParser();

                                mainParser.ExtractNodeData(sub.Data, out subnodes);
                                sub.SubNodes.AddRange(subnodes);
                            }
                        }
                    }

                    // rest of the node
                    if (patched.Length != 0)
                    {
                        var patchedParser = new MainParser();

                        IList <INodeData> restOfNodes = null;

                        patchedParser.ExtractNodeData(patched, out restOfNodes);

                        for (int i1 = 0; i1 < restOfNodes.Count; i1++)
                        {
                            INodeData n = restOfNodes[i1];
                            NodeDatas.Add(n);
                        }
                    }

                    return;
                }
            }
        }
예제 #10
0
        private void OnChallengerListener(string dataId, INodeData data)
        {
            ArenaChallenger challenger = data as ArenaChallenger;

            Fill(challenger);

            Hotfix_LT.Data.HeroInfoTemplate info = Hotfix_LT.Data.CharacterTemplateManager.Instance.GetHeroInfo(challenger.charId, challenger.skin);
            StartCoroutine(CreateModelCoroutine(info.model_name));
        }
예제 #11
0
 private void Harvest(ToolTypes toolType)
 {
     if (plant != null)
     {
         plant.OnHarvest(toolType, () => plant = null);
         INodeData node = nodeGrid.GetNodeFromXY(X, Y);
         node.Data.IsOccupied = false;
     }
 }
예제 #12
0
 void OnNationDetailListener(string path, INodeData data)
 {
     if (!NationManager.Instance.Detail.Updated)
     {
         return;
     }
     NationManager.Instance.Detail.Updated = false;
     ShowNationUI(NationManager.Instance.Detail);
 }
예제 #13
0
        private void OnRobInfoListener(string path, INodeData data)
        {
            AllianceRobDartInfo info = data as AllianceRobDartInfo;

            MaxPageCount = Mathf.CeilToInt(info.Members.Count / 4.0f);
            MaxPageCount = MaxPageCount <= 0 ? 1 : MaxPageCount;

            CurPageIndex = 0;
            RefreshPage();
        }
예제 #14
0
        private void OnTransferInfoListener(string path, INodeData data)
        {
            AllianceTransferDartInfo info = data as AllianceTransferDartInfo;

            if (info.DataUpdated)
            {
                info.DataUpdated = false;
                RefreshTransferInfo(info);
            }
        }
예제 #15
0
        private void OnInfoListener(string path, INodeData data)
        {
            AllianceEscortUtil.FormatResidueRobDartNum(ResidueRobNumLabel);

            int    residueTransferNum = AllianceEscortUtil.GetResidueTransferDartNum();
            string colorStr           = residueTransferNum > 0 ? LT.Hotfix.Utility.ColorUtility.GreenColorHexadecimal : LT.Hotfix.Utility.ColorUtility.RedColorHexadecimal;

            LTUIUtil.SetText(ResidueTransferDartNumLabel, string.Format(EB.Localizer.GetString("ID_codefont_in_AllianceEscortHudController_2955"), colorStr, residueTransferNum));

            LTUIUtil.SetText(TransferDartTimeLabel, Hotfix_LT.Data.EventTemplateManager.Instance.GetActivityOpenTimeStr("escort_start", "escort_stop"));
        }
예제 #16
0
        void OnNationAccountListener(string path, INodeData data)
        {
            NationAccount account = data as NationAccount;

            if (account.TeamDataUpdated)
            {
                account.TeamDataUpdated = false;

                SetTeamState();
            }
        }
예제 #17
0
        public TreeNode(NodeType type, INodeData data, string text)
        {
            this.data = data;

            Type = type;
            Text = text;

            if (type == NodeType.Node)
            {
                nodes = new ObservableCollection<TreeNode>();
            }
        }
예제 #18
0
 public NodeLink(
     IGraph graph,
     string UniqueId,
     INodeData child,
     List <ICondition> conditions,
     List <IAction> enterActions,
     List <IAction> exitActions) :
     base(graph, UniqueId, new List <INodeData> {
     child
 }, conditions, enterActions, exitActions)
 {
 }
예제 #19
0
        private void OnFlowEnemyListListener(string path, INodeData data)
        {
            var datas = LTLegionWarManager.Instance.QualifyEnemyList.GetFlowEnemyDataList();

            for (int i = 0; i < datas.Count; i++)
            {
                FlowEnemyHudList[i].Fill(datas[i]);
            }
            int myScore = LTLegionWarManager.Instance.QualifyEnemyList.MyScore;

            UpdateChest(myScore);
        }
        private void DeleteSelected()
        {
            try
            {
                if (SelectedNode == null)
                {
                    MessageBoxFactory.ShowError("No item selected");
                    return;
                }

                INodeData parent = null;

                if (SelectedNode.IsBook)
                {
                    Book bk = (Book)SelectedNode.GetData();

                    if (!MessageBoxFactory.ShowConfirmAsBool("Delete book and all notes for '" + bk.Title + "'?", "Delete Book"))
                    {
                        return;
                    }

                    parent = bk.DefaultTopic;
                    Util.DB.Books.Remove(bk);
                }
                else if (SelectedNode.IsNote)
                {
                    Note n = (Note)SelectedNode.GetData();
                    if (!MessageBoxFactory.ShowConfirmAsBool("Delete " + n.OriginalText + "'?", "Delete Note"))
                    {
                        return;
                    }

                    parent = n.Book;
                    Util.DB.Notes.Remove(n);
                }
                else if (SelectedNode.IsTopic)
                {
                    Util.DB.Topics.Remove((Topic)SelectedNode.GetData());
                }
                else
                {
                    throw new Exception("Type not supported: " + SelectedNode.GetDataType());
                }

                Util.DB.SaveChanges();
                SetFilter(parent);
            }
            catch (Exception e)
            {
                Util.DB.RejectChanges();
                MessageBoxFactory.ShowError(e);
            }
        }
예제 #21
0
    public List <INodeData> listOutputs()
    {
        var fieldInfos = GetType().GetFields();
        var list       = new List <INodeData>();

        foreach (var item in fieldInfos)
        {
            INodeData data = GetType().GetField(item.Name).GetValue(this) as INodeData;
            list.Add(data);
        }
        return(list);
    }
예제 #22
0
        public TreeNode(NodeType type, INodeData data, string text)
        {
            this.data = data;

            Type = type;
            Text = text;

            if (type == NodeType.Node)
            {
                nodes = new ObservableCollection <TreeNode>();
            }
        }
예제 #23
0
        private void ChangePointerPosition()
        {
            INodeData node = nodeGrid.GetNodeFromMousePosition();

            if (node != null)
            {
                Vector2 pos = node.Data.pos;
                tilePointer.transform.position = pos;
                tilePointer.SetActive(true);

                tilePointerBobbing.StartBob();
            }
        }
예제 #24
0
 private void FinalStatusListener(string path, INodeData value)
 {
     if (isWatchLog)
     {
         StopCoroutine(InitWatchLogFieldType());
         StartCoroutine(InitWatchLogFieldType());
     }
     else
     {
         StopCoroutine(InitFieldType());
         StartCoroutine(InitFieldType());
     }
 }
예제 #25
0
 private void FinalFieldListener(string path, INodeData value)
 {
     if (isWatchLog)
     {
         StopCoroutine(InitWatchLogPlayers());
         StartCoroutine(InitWatchLogPlayers());
     }
     else
     {
         StopCoroutine(InitPlayers());
         StartCoroutine(InitPlayers());
     }
 }
예제 #26
0
        private void Update()
        {
            MoveToolToMouse();

            if (Input.GetMouseButtonDown(0))
            {
                INodeData node = nodeGrid.GetNodeFromMousePosition();
                if (node != null)
                {
                    nodeToToolOn = node;
                }
                ToolToUse = EquippedTool.ToolType;
            }
        }
예제 #27
0
 public Node(INodeData data)
 {
     this.data     = data;
     parallelNodes = new List <Node>();
     UpdateAction  = delegate
     {
         foreach (Node node in parallelNodes)
         {
             node.UpdateNodeState();
         }
     };
     data.Attach(this);
     children = new List <string>();
 }
        private void SelectAndExpand(INodeData toMatch, TreeNode node)
        {
            if (node.GetData() == toMatch)
            {
                TreeNode n = node;
                do
                {
                    n.IsExpanded = true;
                    n            = n.Parent;
                }while (n != null);

                SelectedNode = node;
            }
        }
예제 #29
0
        private void OnBlacklistListener(string path, INodeData data)
        {
            BlackList list = data as BlackList;

            if (list == null || !list.IsHaveUpdate)
            {
                return;
            }

            BlackNum = list.List.Count;
            FriendManager.Instance.Info.BlacklistNum = BlackNum;
            TabController.SetPeopleNum(null, string.Format("{0}/{1}", BlackNum, FriendManager.Instance.Config.MaxBlacklistNum), null, null);
            list.List.Sort(new FriendComparer());
        }
예제 #30
0
        private void OnInfoListener(string path, INodeData data)
        {
            int    residueTransferNum = AllianceEscortUtil.GetResidueTransferDartNum();
            string colorStr           = residueTransferNum > 0 ? LT.Hotfix.Utility.ColorUtility.GreenColorHexadecimal : LT.Hotfix.Utility.ColorUtility.RedColorHexadecimal;

            LTUIUtil.SetText(controller.UiLabels["ResidueTransferDartNumLabel"], string.Format(EB.Localizer.GetString("ID_codefont_in_AllianceEscortHudController_2955"), colorStr, residueTransferNum));

            int    residueRobNum = AllianceEscortUtil.GetResidueRobDartNum();
            string cs            = residueRobNum > 0 ? LT.Hotfix.Utility.ColorUtility.GreenColorHexadecimal : LT.Hotfix.Utility.ColorUtility.RedColorHexadecimal;

            LTUIUtil.SetText(controller.UiLabels["ResidueRobNumLabel"], string.Format(EB.Localizer.GetString("ID_codefont_in_AllianceEscortHudController_3223"), cs, residueRobNum));

            RefreshBtnState();
        }
예제 #31
0
        void OnNationMemberListListener(string path, INodeData data)
        {
            NationMembers members = data as NationMembers;

            if (!members.Updated)
            {
                return;
            }
            members.Updated = false;

            List <NationMember> rankMembers = members.GetMemberByRank(mSelectRank);

            MemberDynamicScroll.SetItemDatas(rankMembers.ToArray());
        }
예제 #32
0
        public ValueBufferNode()
            : base(ValueBufferNodeFactory.TYPESTRING)
        {
            // Prepare Connections
            conExecute = new ExecutionConnectorViewModel();
            conIn = new ConnectorViewModel("Set", typeof(INodeData));
            conOut = new ConnectorViewModel("Value", typeof(INodeData));

            this.InputExecutionConnectors.Add(conExecute);
            this.InputConnectors.Add(conIn);
            this.OutputConnectors.Add(conOut);

            // State Values
            Value = null;

            // Create Dialog
            dlgEdit = new PropertyDialog();
        }
예제 #33
0
        public override void Execute(object context)
        {
            OldValue = Value;

            if (conIn.IsConnected)
            {
                object newContext = new object(); // new exuction node, new execution context
                Value = conIn.AttachedConnections.Select(connection =>
                {
                    try
                    {
                        object tmp = connection.SourceConnector.ParentNode.GetValue(connection.SourceConnector, context);
                        if (typeof(INodeData).IsAssignableFrom(tmp.GetType())) return (INodeData)tmp;
                        return null;
                    }
                    catch
                    {
                        return null;
                    }
                }).Where(val => val != null).FirstOrDefault();
            }
            else
            {
                Value = null;
            }
            OnPropertyChanged("Note");

            if (OldValue != null && Value != null && !OldValue.Equals(Value))
            {
                foreach (ExecutionConnectionViewModel con in this.AttachedExecutionConnections)
                {
                    if (con.SourceConnector != null &&
                        con.SourceConnector.ParentNode == this &&
                        con.DestConnector != null &&
                        con.DestConnector.ParentNode != null)
                    {
                        con.DestConnector.ParentNode.Execute(new object());
                    }
                }
            }
        }
예제 #34
0
 public static TreeNode CreateNode(INodeData data, string text)
 {
     return new TreeNode(NodeType.Node, data,text);
 }
예제 #35
0
 internal static void SetVariable(string varName, INodeData value)
 {
     lock(Variables)
     {
         Variables[varName] = value;
     }
 }
예제 #36
0
        private TreeNode FindNode(INodeData toMatch, ICollection<TreeNode> nodes)
        {
            if (toMatch == null || nodes == null)
                return null;

            foreach (TreeNode n in nodes)
            {
                if (n.GetData() == toMatch)
                    return n;
                else if (n.Type == TreeNode.NodeType.Node)
                {
                    TreeNode found = FindNode(toMatch, n.Nodes);
                    return found;
                }
            }

            return null;
        }
예제 #37
0
        private void TreeList_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
        {
            var selectedNode = e.NewValue as TreeNode;

            if (selectedNode != null)
                SelectedNodeData = selectedNode.GetData();
            else
                SelectedNodeData = null;

            if (OnSelectedChanged != null)
                OnSelectedChanged.Invoke();
        }
예제 #38
0
 public override void Execute(object context)
 {
     if (conIn.IsConnected)
     {
         object newContext = new object(); // new exuction node, new execution context
         Value = conIn.AttachedConnections.Select(connection =>
         {
             try
             {
                 object tmp = connection.SourceConnector.ParentNode.GetValue(connection.SourceConnector, context);
                 if (typeof(INodeData).IsAssignableFrom(tmp.GetType())) return (INodeData)tmp;
                 return null;
             }
             catch
             {
                 return null;
             }
         }).Where(val => val != null).FirstOrDefault();
     }
     else
     {
         Value = null;
     }
     OnPropertyChanged("Note");
 }