Demo fix
This commit is contained in:
@@ -7,7 +7,6 @@ using VirtualChemistry.Chemistry.Mixtures.Implements;
|
|||||||
public partial class Bottle : MenuButton, IChemicalContainer
|
public partial class Bottle : MenuButton, IChemicalContainer
|
||||||
{
|
{
|
||||||
private double ContainerVolume { get; set; }
|
private double ContainerVolume { get; set; }
|
||||||
private HeterogeneousMixture HeterogeneousMixture { get; set; }
|
|
||||||
public double Volume() => ContainerVolume;
|
public double Volume() => ContainerVolume;
|
||||||
|
|
||||||
public HeterogeneousMixture Content { get; set; } = HeterogeneousMixture.Null;
|
public HeterogeneousMixture Content { get; set; } = HeterogeneousMixture.Null;
|
||||||
@@ -64,18 +63,38 @@ public partial class Bottle : MenuButton, IChemicalContainer
|
|||||||
case 2:
|
case 2:
|
||||||
GlobalScene.Demo.SelectedBottle = this;
|
GlobalScene.Demo.SelectedBottle = this;
|
||||||
GlobalScene.MainScene.SwitchToConstructor();
|
GlobalScene.MainScene.SwitchToConstructor();
|
||||||
return;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
Content = GlobalScene.Flask.Content;
|
Content = GlobalScene.Flask.Content;
|
||||||
Content.Container = this;
|
Content.Container = this;
|
||||||
GlobalScene.Flask.Content = HeterogeneousMixture.Null;
|
GlobalScene.Flask.Content = HeterogeneousMixture.Null;
|
||||||
GlobalScene.Flask.Update();
|
GlobalScene.Flask.Update();
|
||||||
return;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
return;
|
GlobalScene.Demo.SelectedBottle = this;
|
||||||
|
GlobalScene.Demo.PopupStringLoader();
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
foreach (HomogeneousMixture m in Content.Layers.ToArray())
|
||||||
|
{
|
||||||
|
m.Volume = m.FreeVolume;
|
||||||
|
GlobalScene.Flask.Content.AddLayer(m);
|
||||||
|
}
|
||||||
|
//GlobalScene.Flask.Content = Content;
|
||||||
|
//Content.Container = GlobalScene.Flask;
|
||||||
|
Content = HeterogeneousMixture.Null;
|
||||||
|
GlobalScene.Flask.Update();
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
GlobalScene.Demo.FullRepr.Text = Content.Dump();
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
Content = HeterogeneousMixture.Null;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
|
BuildMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the node enters the scene tree for the first time.
|
// Called when the node enters the scene tree for the first time.
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ using VirtualChemistry.Chemistry.Mixtures.Implements;
|
|||||||
|
|
||||||
public partial class Flask : TextureRect, IChemicalContainer
|
public partial class Flask : TextureRect, IChemicalContainer
|
||||||
{
|
{
|
||||||
public double ContainerVolume { get; set; } = 100;
|
public double ContainerVolume { get; set; } = 0.5;
|
||||||
|
private TextureRect InnerLayer { get; set; }
|
||||||
public double Volume() => ContainerVolume;
|
public double Volume() => ContainerVolume;
|
||||||
|
|
||||||
public HeterogeneousMixture Content { get; set; }
|
public HeterogeneousMixture Content { get; set; }
|
||||||
@@ -24,8 +24,9 @@ public partial class Flask : TextureRect, IChemicalContainer
|
|||||||
.Load<PackedScene>("res://Scenes/FlaskContent.tscn")
|
.Load<PackedScene>("res://Scenes/FlaskContent.tscn")
|
||||||
.Instantiate<FlaskContent>();
|
.Instantiate<FlaskContent>();
|
||||||
fc.Mixture = m;
|
fc.Mixture = m;
|
||||||
AddChild(fc);
|
InnerLayer.AddChild(fc);
|
||||||
fc.Position = new(0, -(float)fc.StartFrom);
|
fc.Position = new(0, -(float)fc.StartFrom);
|
||||||
|
Map[m] = fc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +51,8 @@ public partial class Flask : TextureRect, IChemicalContainer
|
|||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
GlobalScene.Flask = this;
|
GlobalScene.Flask = this;
|
||||||
Content = HeterogeneousMixture.Null;
|
Content = new(this);
|
||||||
|
InnerLayer = GetNode<TextureRect>("InnerLayer");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
|||||||
@@ -8,3 +8,16 @@ offset_right = 40.0
|
|||||||
offset_bottom = 40.0
|
offset_bottom = 40.0
|
||||||
texture = ExtResource("1_b34pm")
|
texture = ExtResource("1_b34pm")
|
||||||
script = ExtResource("2_j1pe5")
|
script = ExtResource("2_j1pe5")
|
||||||
|
|
||||||
|
[node name="InnerLayer" type="TextureRect" parent="."]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_right = 40.0
|
||||||
|
offset_bottom = 40.0
|
||||||
|
texture = ExtResource("1_b34pm")
|
||||||
|
|
||||||
|
[node name="OuterLayer" type="TextureRect" parent="."]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_right = 40.0
|
||||||
|
offset_bottom = 40.0
|
||||||
|
mouse_filter = 2
|
||||||
|
texture = ExtResource("1_b34pm")
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using Godot;
|
using Godot;
|
||||||
using Skeleton.DataStructure.Link;
|
using Skeleton.DataStructure.Link;
|
||||||
using VirtualChemistry.Chemistry.Mixtures.Implements;
|
using VirtualChemistry.Chemistry.Mixtures.Implements;
|
||||||
@@ -28,6 +29,16 @@ public partial class FlaskContent : ColorRect
|
|||||||
public void UpdateVolumeAndPosition()
|
public void UpdateVolumeAndPosition()
|
||||||
{
|
{
|
||||||
double height = (Volume / ContainerVolume) * ContainerHeight;
|
double height = (Volume / ContainerVolume) * ContainerHeight;
|
||||||
|
Position = new Vector2(Position.X, 512-(float)(StartFrom + height));
|
||||||
|
Size = new Vector2(Size.X, (float)height);
|
||||||
|
//Mask.Size = Size;
|
||||||
|
Color = Color.Color8(
|
||||||
|
Mixture.ColorRed,
|
||||||
|
Mixture.ColorGreen,
|
||||||
|
Mixture.ColorGreen,
|
||||||
|
Mixture.ColorTransparent
|
||||||
|
);
|
||||||
|
/*
|
||||||
Animation a = AP.GetAnimation("HeightChange");
|
Animation a = AP.GetAnimation("HeightChange");
|
||||||
a.TrackSetKeyValue(0, 0, Size);
|
a.TrackSetKeyValue(0, 0, Size);
|
||||||
a.TrackSetKeyValue(0, 1, new Vector2(Size.X, (float)height));
|
a.TrackSetKeyValue(0, 1, new Vector2(Size.X, (float)height));
|
||||||
@@ -36,7 +47,8 @@ public partial class FlaskContent : ColorRect
|
|||||||
a = AP.GetAnimation("PositionChange");
|
a = AP.GetAnimation("PositionChange");
|
||||||
a.TrackSetKeyValue(0,0,Position);
|
a.TrackSetKeyValue(0,0,Position);
|
||||||
a.TrackSetKeyValue(0,1, new Vector2(Position.X, -(float)StartFrom));
|
a.TrackSetKeyValue(0,1, new Vector2(Position.X, -(float)StartFrom));
|
||||||
AP.Play();
|
Color = Color.Color8(Mixture.ColorRed, Mixture.ColorGreen, Mixture.ColorGreen, Mixture.ColorTransparent);
|
||||||
|
AP.Play();*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the node enters the scene tree for the first time.
|
// Called when the node enters the scene tree for the first time.
|
||||||
|
|||||||
@@ -82,3 +82,4 @@ offset_bottom = 4.0
|
|||||||
[connection signal="resized" from="." to="." method="OnSizeChange"]
|
[connection signal="resized" from="." to="." method="OnSizeChange"]
|
||||||
[connection signal="mouse_entered" from="Mask" to="." method="OnMouseEnter"]
|
[connection signal="mouse_entered" from="Mask" to="." method="OnMouseEnter"]
|
||||||
[connection signal="mouse_exited" from="Mask" to="." method="OnMouseExit"]
|
[connection signal="mouse_exited" from="Mask" to="." method="OnMouseExit"]
|
||||||
|
[connection signal="pressed" from="Mask" to="." method="OnClick"]
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ public partial class MainControlPanel : HBoxContainer
|
|||||||
Amount = GetNode<Label>("V2/HAmount/Amount");
|
Amount = GetNode<Label>("V2/HAmount/Amount");
|
||||||
Temperature = GetNode<Label>("V2/HTemperature/Temperature");
|
Temperature = GetNode<Label>("V2/HTemperature/Temperature");
|
||||||
Compounds = GetNode<Tree>("V3/Compounds");
|
Compounds = GetNode<Tree>("V3/Compounds");
|
||||||
|
|
||||||
GlobalScene.MainControlPanel = this;
|
GlobalScene.MainControlPanel = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,6 +38,7 @@ public partial class MainControlPanel : HBoxContainer
|
|||||||
public void Update(HomogeneousMixture mixture)
|
public void Update(HomogeneousMixture mixture)
|
||||||
{
|
{
|
||||||
SelectedMixture = mixture;
|
SelectedMixture = mixture;
|
||||||
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
@@ -45,7 +47,7 @@ public partial class MainControlPanel : HBoxContainer
|
|||||||
return;
|
return;
|
||||||
Density.Text = $"{SelectedMixture.Density}";
|
Density.Text = $"{SelectedMixture.Density}";
|
||||||
Volume.Text = $"{SelectedMixture.Volume}";
|
Volume.Text = $"{SelectedMixture.Volume}";
|
||||||
HeatConductivity.Text = $"{SelectedMixture.HeatConductivity}";
|
HeatConductivity.Text = $"{SelectedMixture.HeatConductivity.Get}";
|
||||||
Amount.Text = $"{SelectedMixture.Amount}";
|
Amount.Text = $"{SelectedMixture.Amount}";
|
||||||
Temperature.Text = $"{SelectedMixture.Temperature}";
|
Temperature.Text = $"{SelectedMixture.Temperature}";
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ public partial class StringLoader : Window
|
|||||||
{
|
{
|
||||||
Input = GetNode<TextEdit>("V1/Input");
|
Input = GetNode<TextEdit>("V1/Input");
|
||||||
GlobalScene.StringLoader = this;
|
GlobalScene.StringLoader = this;
|
||||||
|
Visible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Load()
|
private void Load()
|
||||||
|
|||||||
@@ -7,6 +7,11 @@ public partial class VirtualChemDemo : Node2D
|
|||||||
public Bottle SelectedBottle { get; set; }
|
public Bottle SelectedBottle { get; set; }
|
||||||
private StringLoader ExpressionLoader { get; set; }
|
private StringLoader ExpressionLoader { get; set; }
|
||||||
|
|
||||||
|
public void PopupStringLoader()
|
||||||
|
{
|
||||||
|
ExpressionLoader.Visible = true;
|
||||||
|
}
|
||||||
|
|
||||||
public void OneStep()
|
public void OneStep()
|
||||||
{
|
{
|
||||||
Flask.Content.OneStep();
|
Flask.Content.OneStep();
|
||||||
@@ -21,6 +26,7 @@ public partial class VirtualChemDemo : Node2D
|
|||||||
FullRepr = GetNode<RichTextLabel>("HRepr/FullRepr");
|
FullRepr = GetNode<RichTextLabel>("HRepr/FullRepr");
|
||||||
Flask = GetNode<Flask>("Flask");
|
Flask = GetNode<Flask>("Flask");
|
||||||
GlobalScene.Demo = this;
|
GlobalScene.Demo = this;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
|||||||
Reference in New Issue
Block a user