Ejemplo n.º 1
0
        public void UpdatePartSub(bool toggle)
        {
            if (EditSlot == null || IgnoreEvents)
            {
                return;
            }
            if (toggle)
            {
                EditSlot.Slot.EquipedPart.SubWeapon = new WeaponStats();
            }
            else
            {
                EditSlot.Slot.EquipedPart.SubWeapon = null;
            }

            Color textColor = EditSlot.Slot.Joint == PartJoint.JointType.WB ? DefaultColors.WB : DefaultColors.Value;

            if (EditSlot.Slot.EquipedPart.MainWeapon != null && EditSlot.Slot.EquipedPart.SubWeapon != null)
            {
                textColor = DefaultColors.MAINSUB;
            }
            else if (EditSlot.Slot.EquipedPart.MainWeapon != null)
            {
                textColor = DefaultColors.MAIN;
            }
            else if (EditSlot.Slot.EquipedPart.SubWeapon != null)
            {
                textColor = DefaultColors.SUB;
            }
            EditSlot.NameText.color = textColor;
            //Event callback
            OnRedraw?.Invoke(EditSlot);
        }
Ejemplo n.º 2
0
        public void Load(Tune loadData)
        {
            AssembledData = loadData;

            //Materials
            for (int i = 0; i < MaterialSlots.Count; i++)
            {
                Destroy(MaterialSlots[i].gameObject);
            }
            MaterialSlots.Clear();

            for (int i = 0; i < AssembledData.CraftMaterials.Count; i++)
            {
                CraftMaterialSlot craftMaterialSlot = Instantiate(MaterialSlotTemplate, MaterialTemplate.transform);
                craftMaterialSlot.gameObject.SetActive(true);
                craftMaterialSlot.NameInputField.SetTextWithoutNotify(AssembledData.CraftMaterials[i].Name);
                craftMaterialSlot.AmountInputField.SetTextWithoutNotify(AssembledData.CraftMaterials[i].Amount.ToString());
                craftMaterialSlot.GetComponent <RectTransform>().anchoredPosition = new Vector2(MaterialOffset.x, MaterialOffset.y * MaterialSlots.Count);
                MaterialSlots.Add(craftMaterialSlot);
            }
            MaterialAddButton.anchoredPosition = new Vector2(MaterialOffset.x, MaterialOffset.y * MaterialSlots.Count);
            RecalculateContent();

            //Event callback
            OnRedraw?.Invoke(AssembledData);
        }
Ejemplo n.º 3
0
 public void CallRedraw(Bitmap bitmap)
 {
     OnRedraw?.Invoke(null, new DrawBufferEventArgs()
     {
         Bitmap = bitmap
     });
 }
Ejemplo n.º 4
0
 public void EditSlotsReset()
 {
     if (EditSlot != null)
     {
         EditSlot.SelectionBox.gameObject.SetActive(false);
     }
     EditSlot = null;
     OnRedraw?.Invoke(null);
 }
Ejemplo n.º 5
0
        public void UpdateJointType(int num)
        {
            if (EditSlot == null || IgnoreEvents)
            {
                return;
            }
            EditSlot.Slot.Joint = (PartJoint.JointType)num;
            if (EditSlot.Slot.EquipedPart != null)
            {
                EditSlot.Slot.EquipedPart.Joint = EditSlot.Slot.Joint;
                if (EditSlot.transform == Root.transform && EditSlot.Slot.EquipedPart.Joint == PartJoint.JointType.BD)
                {
                    if (EditSlot.Slot.EquipedPart.BDMask.Mask == 0)
                    {
                        EditSlot.Slot.EquipedPart.BDMask.AddFlag((int)Part.BDType.Lnd);
                    }
                    else
                    {
                        for (int i = 0; i < 4; i++)
                        {
                            if (EditSlot.Slot.EquipedPart.BDMask.HasFlag(i))
                            {
                                EditSlot.Slot.EquipedPart.BDMask.ClearFlags();
                                EditSlot.Slot.EquipedPart.BDMask.AddFlag(i);
                                break;
                            }
                        }
                    }
                }
            }
            EditSlot.TypeText.text   = EditSlot.Slot.Joint.ToString();
            EditSlot.TypeIcon.sprite = Calculator.instance.JointIcons.Icons[EditSlot.Slot.Joint];
            Color textColor = EditSlot.Slot.Joint == PartJoint.JointType.WB ? DefaultColors.WB : DefaultColors.Value;

            if (EditSlot.Slot.EquipedPart != null)
            {
                if (EditSlot.Slot.EquipedPart.MainWeapon != null && EditSlot.Slot.EquipedPart.SubWeapon != null)
                {
                    textColor = DefaultColors.MAINSUB;
                }
                else if (EditSlot.Slot.EquipedPart.MainWeapon != null)
                {
                    textColor = DefaultColors.MAIN;
                }
                else if (EditSlot.Slot.EquipedPart.SubWeapon != null)
                {
                    textColor = DefaultColors.SUB;
                }
            }
            EditSlot.NameText.color = textColor;
            //Event callback
            OnRedraw?.Invoke(EditSlot);
        }
Ejemplo n.º 6
0
 public void Load(Contraption loadData)
 {
     if (Root.Slot.EquipedPart != null)
     {
         RemovePart(Root);
     }
     AssembledData = loadData;
     Root.Slot     = AssembledData.Root;
     LoadBranch(Root);
     RecalculateContent(Root.GetComponent <RectTransform>());
     //Event callback
     OnRedraw?.Invoke(EditSlot);
 }
Ejemplo n.º 7
0
 public void CreateNew()
 {
     if (Root.Slot.EquipedPart != null)
     {
         RemovePart(Root);
     }
     AssembledData = new Contraption();
     Root.Slot     = AssembledData.Root;
     Root.Slot.Tags.Add("Universal", "Universal");
     LoadBranch(Root);
     RecalculateContent(Root.GetComponent <RectTransform>());
     //Event callback
     OnRedraw?.Invoke(EditSlot);
 }
Ejemplo n.º 8
0
 public void RemoveJoint(PartJointSlot jointSlot)
 {
     //Ensures that the joint can only be removed if a parent exists
     if (jointSlot.Parent)
     {
         RemoveBranchStats(jointSlot);
         jointSlot.Parent.Slot.EquipedPart.SubJoints.Remove(jointSlot.Slot);
         jointSlot.Parent.SubJoints.Remove(jointSlot);
         RemoveBranch(jointSlot.Parent, jointSlot.BranchCount, jointSlot.BranchIndex);
         Destroy(jointSlot.gameObject);
         RecalculateContent(Root.GetComponent <RectTransform>());
         //Event callback
         OnRedraw?.Invoke(EditSlot);
     }
 }
Ejemplo n.º 9
0
 public void JointSelect(PartJointSlot jointSlot)
 {
     if (EditSlot != null)
     {
         if (EditSlot.transform == jointSlot.transform)
         {
             return;
         }
         EditSlot.SelectionBox.gameObject.SetActive(false);
     }
     jointSlot.SelectionBox.gameObject.SetActive(true);
     EditSlot = jointSlot;
     //Event callback
     OnRedraw?.Invoke(jointSlot);
 }
Ejemplo n.º 10
0
        public void CreateNew()
        {
            AssembledData = new Tune();

            //Materials
            for (int i = 0; i < MaterialSlots.Count; i++)
            {
                Destroy(MaterialSlots[i].gameObject);
            }
            MaterialSlots.Clear();
            MaterialAddButton.anchoredPosition = new Vector2(MaterialOffset.x, MaterialOffset.y * MaterialSlots.Count);
            RecalculateContent();

            //Event callback
            OnRedraw?.Invoke(AssembledData);
        }
Ejemplo n.º 11
0
        private async Task RenderingLoop(TextWriter writer)
        {
            var milliseconds = GlobalMilliseconds;

            while (true)
            {
                var previousFrameMilliseconds = GlobalMilliseconds - milliseconds;
                FPS          = (int)Math.Floor(1000d / previousFrameMilliseconds);
                milliseconds = GlobalMilliseconds;
                var array = new char[Columns * Rows];
                OnRedraw?.Invoke(array, previousFrameMilliseconds);
                await writer.WriteAsync(array);

                await writer.FlushAsync();

                Console.SetCursorPosition(0, 0);
            }
        }
Ejemplo n.º 12
0
        protected virtual void _Redraw(string state = " ", ConsoleColor backgroundcolor = (ConsoleColor)(-1), ConsoleColor borderstextcolor = (ConsoleColor)(-1))
        {
            if (IsRedrawing)
            {
                return;
            }

            CState = state;


            new Thread(() =>
            {
                IsRedrawing = true;

                var p            = new Point(Owner.Cursor.X, Owner.Cursor.Y);
                var OldTextColor = Console.ForegroundColor;
                var OldBackColor = Console.BackgroundColor;
                Console.ResetColor();

                Console.ForegroundColor = (borderstextcolor == (ConsoleColor)(-1) ? CBordersTextColor : borderstextcolor);
                Console.BackgroundColor = (backgroundcolor == (ConsoleColor)(-1) ? CBackgroundColor : backgroundcolor);

                if (CVisible && !CFreed)
                {
                    _Clear(' ', false);
                    if (CShowBorders)
                    {
                        Drawing.DrawBorder(new Rect(CLocation, CSize), CBorder, this);
                    }
                    if (!string.IsNullOrEmpty(CText))
                    {
                        Drawing.DrawText(new Rect(CLocation, CSize), CText, (CShowBorders ? new Rect(1) : new Rect(0)) + CPadding, CTextCentered, CState, this);
                    }
                }

                Console.ForegroundColor = OldTextColor;
                Console.BackgroundColor = OldBackColor;
                GoToXY(p.X, p.Y);

                OnRedraw?.Invoke();

                IsRedrawing = false;
            }).Start();
        }
Ejemplo n.º 13
0
 public void UpdateJointPart(bool toggle)
 {
     if (EditSlot == null || IgnoreEvents)
     {
         return;
     }
     if (toggle)
     {
         EditSlot.Builder.CreatePart(EditSlot);
     }
     else
     {
         EditSlot.Builder.RemovePart(EditSlot);
         EditSlot.NameText.text  = "-";
         EditSlot.NameText.color = DefaultColors.Value;
         EditSlot.TypeIcon.color = Color.white;
     }
     //Event callback
     OnRedraw?.Invoke(EditSlot);
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Redraws the automata.
 /// </summary>
 public void Redraw()
 {
     OnRedraw?.Invoke();
 }
Ejemplo n.º 15
0
 void Start()
 {
     //Event callback
     OnRedraw?.Invoke(EditSlot);
 }
Ejemplo n.º 16
0
 void Start()
 {
     OnRedraw?.Invoke(AssembledData);
 }
Ejemplo n.º 17
0
 private void Redraw(IGraphicExtension sender, bool resetModel)
 {
     OnRedraw?.Invoke(sender, resetModel);
 }
Ejemplo n.º 18
0
 public void SelectableHover(ISelectable selectable)
 {
     //Event callback
     OnRedraw?.Invoke(selectable);
 }
 public void Load(Cartridge loadData)
 {
     AssembledData = loadData;
     //Event callback
     OnRedraw?.Invoke(AssembledData);
 }
 public void CreateNew()
 {
     AssembledData = new Cartridge();
     //Event callback
     OnRedraw?.Invoke(AssembledData);
 }
 void Start()
 {
     //Event callback
     OnRedraw?.Invoke(AssembledData);
 }