예제 #1
0
        private void DisplayGroupNode(BaseNode nodeToDisplay)
        {
            CurrentDisplayNode = nodeToDisplay;
            int             count = nodeToDisplay.Children.Count;
            List <BaseNode> list  = new List <BaseNode>(count + 1);

            list.Add(nodeToDisplay);
            list.AddRange(nodeToDisplay.Children);
            for (uint num = (uint)list.Count; num < orderedControllers.Length; num++)
            {
                ITileController tileController = orderedControllers[num];
                if (tileController != null)
                {
                    DestroyController(num, destroyView: true);
                }
            }
            for (uint num = 0u; num < list.Count; num++)
            {
                BaseNode node = list[(int)num];
                if (num >= orderedCells.Length)
                {
                    logger.Warn("The hex grid is not large enough to fit all nodes.");
                }
                else
                {
                    SetupTileController(num, node);
                }
            }
        }
예제 #2
0
        public IEnumerator delayInitEditSerializedStringView(InspectorStringView stringView, ITweakable tweakable, ITweakerSerializer serializer)
        {
            yield return(null);

            object value = tweakable.GetValue();

            if (value != null)
            {
                stringView.InputText.text = serializer.Serialize(value);
            }
            else
            {
                stringView.InputText.text = "";
            }
            stringView.ValueChanged += delegate(string newValue)
            {
                object obj = serializer.Deserialize(newValue, tweakable.TweakableType);
                if (obj != null)
                {
                    tweakable.SetValue(obj);
                }
                else
                {
                    logger.Warn("Failed to deserialize string to type '" + tweakable.TweakableType.FullName + "': " + newValue);
                }
            };
            Action <object, object> tweakableValueChanged = delegate(object oldValue, object newValue)
            {
                stringView.InputText.text = serializer.Serialize(newValue);
            };

            tweakable.ValueChanged += tweakableValueChanged;
            stringView.Destroyed   += delegate
            {
                tweakable.ValueChanged -= tweakableValueChanged;
            };
            stringView.gameObject.SetActive(value: true);
        }