Skip to content

Commit

Permalink
Merge pull request #475 from Nashet/ver.0.20
Browse files Browse the repository at this point in the history
Ver 0 20
  • Loading branch information
Nashet authored Apr 2, 2018
2 parents f5d555a + 4f89696 commit 87dc961
Show file tree
Hide file tree
Showing 18 changed files with 61 additions and 23 deletions.
5 changes: 4 additions & 1 deletion Assets/DebugWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ private void Start()
{
Exist = true;
devModeToggle.isOn = Game.devMode;
logInvestmentsToggle.isOn = Game.logInvestments;
}

public override void Hide()
Expand All @@ -42,7 +43,9 @@ public void OnDevModeChange(bool value)
}

public void OnLogInvestmentsChange(bool value)
{ }
{
Game.logInvestments = value;
}

public void OnLogMarketFailsChange(bool value)
{ }
Expand Down
Binary file modified Assets/EconomicSimulation/ES-base.unity
Binary file not shown.
13 changes: 9 additions & 4 deletions Assets/EconomicSimulation/Scripts/Logic/Country.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class Country : MultiSeller, IClickable, IShareOwner, ISortableName, INam
public readonly List<AbstractReform> reforms = new List<AbstractReform>();
public readonly List<Movement> movements = new List<Movement>();

private readonly string name;
private string name;
private readonly Culture culture;
private readonly Color nationalColor;
private Province capital;
Expand Down Expand Up @@ -205,6 +205,11 @@ public Country(string name, Culture culture, Color color, Province capital, floa
}
}

internal void SetName(string v)
{
name = v;
}

private void ressurect(Province province, Government.ReformValue newGovernment)
{
alive = true;
Expand Down Expand Up @@ -983,17 +988,17 @@ public void AIThink()
{
var isFactory = x.Key as Factory;
if (isFactory != null)
return Country.InventedFactory(isFactory.Type);
return InventedFactory(isFactory.Type);
else
{
var newFactory = x.Key as NewFactoryProject;
if (newFactory != null)
return Country.InventedFactory(newFactory.Type);
return InventedFactory(newFactory.Type);
}
return true;
}
).MaxByRandom(x => x.Value.get());
if (!project.Equals(default(KeyValuePair<IInvestable, Procent>)) && project.Value.isBiggerThan(Options.minMarginToInvest))
if (!project.Equals(default(KeyValuePair<IInvestable, Procent>)) && project.Value.isBiggerThan(Options.minMarginToInvest.Copy().Multiply(Options.InvestorEmploymentSafety)))
{
MoneyView investmentCost = project.Key.GetInvestmentCost();
if (!CanPay(investmentCost))
Expand Down
3 changes: 2 additions & 1 deletion Assets/EconomicSimulation/Scripts/Logic/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ namespace Nashet.EconomicSimulation
{
public class Game : ThreadedJob
{
internal static bool devMode = false;
public static bool devMode = false;
public static bool logInvestments = false;

private static readonly bool readMapFormFile = false;
private static MyTexture mapTexture;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ public Procent getBusinessSecurity(IInvestable business)
{
var res = business.Country.OwnershipSecurity;

if (business.Country != Country)
res.Multiply(Options.InvestingForeignCountrySecurity);
//if (business.Country != Country)
// res.Multiply(Options.InvestingForeignCountrySecurity);

if (business.Province != Province)
res.Multiply(Options.InvestingAnotherProvinceSecurity);
//if (business.Province != Province)
// res.Multiply(Options.InvestingAnotherProvinceSecurity);

if (business is NewFactoryProject) // building, upgrading and opening requires hiring people which can be impossible
res.Multiply(Options.InvestorEmploymentSafety);
Expand Down
17 changes: 10 additions & 7 deletions Assets/EconomicSimulation/Scripts/Logic/Production/Factory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ internal static readonly DoubleConditionsList
conditionsDestroy = new DoubleConditionsList(new List<Condition> {
//new Condition(Economy.isNotLF, x=>(x as Producer).Country),
conPlacedInOurCountry, Economy.isNotLF }),//}).addForSecondObject(new List<Condition> {
// (status == Economy.PlannedEconomy || status == Economy.NaturalEconomy || status == Economy.StateCapitalism)
// (status == Economy.PlannedEconomy || status == Economy.NaturalEconomy || status == Economy.StateCapitalism)
conditionsNatinalize = new DoubleConditionsList(new List<Condition> { conNotFullyBelongsToCountry, conPlacedInOurCountry,
Economy.isNotLF, Economy.isNotInterventionism }),//}) .addForSecondObject(new List<Condition> {
conditionsSubsidize = new DoubleConditionsList(new List<Condition> { conPlacedInOurCountry ,Economy.isNotLF, Economy.isNotNatural,
Expand Down Expand Up @@ -239,8 +239,8 @@ public Factory(Province province, IShareOwner investor, ProductionType type, Mon
salary.Set(province.getLocalMinSalary());
if (Country.economy.getValue() == Economy.PlannedEconomy)
setPriorityAutoWithPlannedEconomy();
//else
// Debug.Log(investor + " invested " + cost + " in building new " + this);
if (Game.logInvestments)
Debug.Log(investor + " invested " + cost + " in building new " + this +" awaiting " + type.GetPossibleMargin(province)+ " margin");
}
}

Expand Down Expand Up @@ -908,7 +908,8 @@ internal void open(IShareOwner byWhom, bool payMoney)
{
agent.PayWithoutRecord(this, getReopenCost());
ownership.Add(byWhom, getReopenCost());
//Debug.Log(byWhom + " invested " + getReopenCost() + " in reopening " + this);
if (Game.logInvestments)
Debug.Log(byWhom + " invested " + getReopenCost() + " in reopening " + this + " awaiting " + this.Type.GetPossibleMargin(Province) + " margin");
}
_isOpen = true;
daysUnprofitable = 0;
Expand Down Expand Up @@ -956,10 +957,12 @@ internal void upgrade(IShareOwner byWhom)
var cost = Game.market.getCost(getUpgradeNeeds());
(byWhom as Agent).PayWithoutRecord(this, cost);
ownership.Add(byWhom, cost);
//Debug.Log(byWhom + " invested " + cost + " in upgrading " + this);
if (Game.logInvestments)
Debug.Log(byWhom + " invested " + cost + " in upgrading " + this + " awaiting " + GetMargin() + " margin");
}
//else
// Debug.Log(byWhom + " invested in upgrading " + this);
else
if (Game.logInvestments)
Debug.Log(byWhom + " invested in upgrading " + this);
}

internal int getDaysInConstruction()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,8 @@ internal void BuyStandardShare(IShareOwner buyer)
shareToBuy.Value.ReduceSale(cost);

var boughtProcent = new Procent(cost, parent.ownership.totallyInvested);
//Debug.Log(buyer + " bough " + boughtProcent + " shares (" + cost + ") of " + parent + " from " + shareToBuy.Key);
if (Game.logInvestments)
Debug.Log(buyer + " bough " + boughtProcent + " shares (" + cost + ") of " + parent + " from " + shareToBuy.Key + " awaiting " + GetMargin() + " margin");
}
}
}
Expand Down
1 change: 1 addition & 0 deletions Assets/EconomicSimulation/Scripts/Logic/World.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ internal static void CreateCountries()
}
Game.Player = allCountries[1]; // not wild Tribes, DONT touch that

allCountries.Random().SetName("Zacharia");
//foreach (var pro in allProvinces)
// if (pro.Country == null)
// pro.InitialOwner(World.UncolonizedLand);
Expand Down
2 changes: 1 addition & 1 deletion Assets/EconomicSimulation/Scripts/Panels/BottomPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class BottomPanel : Window
private void Awake() // used to position other windows
{
MainCamera.bottomPanel = this;
generalText.text = "Prosperity Wars v0.19.3";
generalText.text = "Prosperity Wars v0.19.4";
Hide();
}

Expand Down
2 changes: 1 addition & 1 deletion Assets/EconomicSimulation/Scripts/Panels/PoliticsPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private void Start()
voteButton.interactable = false;
dropDown.interactable = false;
forceDecisionButton.interactable = false;
GetComponent<RectTransform>().anchoredPosition = new Vector2(15f, 15f);
GetComponent<RectTransform>().anchoredPosition = new Vector2(15f, 45f);
Hide();
}

Expand Down
6 changes: 6 additions & 0 deletions Assets/UnityUIUtils/Scripts/TooltipBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ public class TooltipBase : MonoBehaviour
[SerializeField]
private RectTransform bgImage;

private void Start()
{
var image =transform.parent.GetComponent<Image>();
image.color = GUIChanger.DarkestColor;
}

// Use this for initialization
private void Awake()
{
Expand Down
Binary file modified WEBGL/Build/WEBGL.asm.code.unityweb
Binary file not shown.
Binary file modified WEBGL/Build/WEBGL.asm.framework.unityweb
Binary file not shown.
Binary file modified WEBGL/Build/WEBGL.asm.memory.unityweb
Binary file not shown.
Binary file modified WEBGL/Build/WEBGL.data.unityweb
Binary file not shown.
4 changes: 2 additions & 2 deletions WEBGL/TemplateData/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
/* Container holding the image and the text */
.container {
position: relative;
text-align: center;
text-align: left;
color: black;
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
font-size: 22px;
Expand All @@ -68,7 +68,7 @@ font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
/* Top left text */
.top-left {
position: absolute;
top: 210px;
top: 160px;
left: 120px;
}

Expand Down
20 changes: 19 additions & 1 deletion WEBGL/credits.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,25 @@
<body>
<div class="container">
<img src="credits_background.png" alt="Background" style="width:100%;">
<div class="top-left">Nashetovich - coding in general<br/><br/>more soming soon</div>
<div class="top-left">Credits:
<br/>
<br/>Nashetovich - coding in general
<br/>dillyo09 - bug fixing
<br/>Zachary Pruckowski - sponsorship
<br/>Jakob Stenberg - sponsorship
<br/>el lyss - sponsorship
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>Support that game on <a href="https://www.patreon.com/economicsimulation" target="_blank">Patreon</a>!
</div>
</div>
</body>
</html>
Binary file modified WEBGL/credits_background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 87dc961

Please sign in to comment.