Beispiel #1
0
    private static void TransferLiquids(LiquidContainer from, LiquidContainer to)
    {
        LiquidContainerInfo liquidContainerInfo  = (LiquidContainerInfo)from.m_Info;
        LiquidContainerInfo liquidContainerInfo2 = (LiquidContainerInfo)to.m_Info;

        if (liquidContainerInfo.m_LiquidType != liquidContainerInfo2.m_LiquidType)
        {
            if (liquidContainerInfo2.m_Amount >= 1f)
            {
                HUDMessages.Get().AddMessage(GreenHellGame.Instance.GetLocalization().Get("Liquids_Conflict", true), null, HUDMessageIcon.None, "", null);
                return;
            }
            liquidContainerInfo2.m_LiquidType = liquidContainerInfo.m_LiquidType;
        }
        float amount = liquidContainerInfo2.m_Amount;

        liquidContainerInfo2.m_Amount += liquidContainerInfo.m_Amount;
        liquidContainerInfo2.m_Amount  = Mathf.Clamp(liquidContainerInfo2.m_Amount, 0f, liquidContainerInfo2.m_Capacity);
        float num = liquidContainerInfo2.m_Amount - amount;

        liquidContainerInfo.m_Amount -= num;
        to.ReplRequestOwnership(false);
        to.OnGet();
        from.ReplRequestOwnership(false);
        from.OnPour();
    }
Beispiel #2
0
    private void SendTextMessage()
    {
        string text = this.m_Field.text;

        if (text.Trim().Length > 0)
        {
            P2PSession.Instance.SendTextChatMessage(text);
            HUDMessages.Get().AddMessage(GreenHellGame.Instance.GetLocalization().Get("HUDTextChat_MessagePrefixLocalPlayer", true) + text, null, HUDMessageIcon.None, "", null);
        }
    }
Beispiel #3
0
    private void TransferLiquids(LiquidContainer to)
    {
        LiquidContainerInfo liquidContainerInfo = (LiquidContainerInfo)to.m_Info;

        if (this.m_LiquidType != liquidContainerInfo.m_LiquidType)
        {
            if (liquidContainerInfo.m_Amount > 0f)
            {
                HUDMessages.Get().AddMessage(GreenHellGame.Instance.GetLocalization().Get("Liquids_Conflict"), null, HUDMessageIcon.None, string.Empty);
                return;
            }
            liquidContainerInfo.m_LiquidType = this.m_LiquidType;
        }
        liquidContainerInfo.m_Amount = liquidContainerInfo.m_Capacity;
        to.OnGet();
    }
Beispiel #4
0
    private void TransferLiquids(LiquidContainer to)
    {
        LiquidContainerInfo liquidContainerInfo = (LiquidContainerInfo)to.m_Info;

        if (this.m_LiquidType != liquidContainerInfo.m_LiquidType)
        {
            if (liquidContainerInfo.m_Amount > 0f)
            {
                HUDMessages.Get().AddMessage(GreenHellGame.Instance.GetLocalization().Get("Liquids_Conflict", true), null, HUDMessageIcon.None, "", null);
                return;
            }
            liquidContainerInfo.m_LiquidType = this.m_LiquidType;
        }
        liquidContainerInfo.m_Amount = liquidContainerInfo.m_Capacity;
        to.OnGet();
        to.ReplRequestOwnership(false);
    }
Beispiel #5
0
    public void OnSkillAction()
    {
        if (this.m_Value >= Skill.s_MaxValue)
        {
            return;
        }
        int num = Mathf.FloorToInt(this.m_Value);

        this.m_Value += this.m_Progress.Progress(this.m_Value);
        this.m_Value  = Mathf.Clamp(this.m_Value, 0f, Skill.s_MaxValue);
        Localization localization = GreenHellGame.Instance.GetLocalization();
        int          num2         = Mathf.FloorToInt(this.m_Value);

        if (num2 > num && HUDMessages.Get())
        {
            HUDMessages.Get().AddMessage(localization.Get("Skill_" + this.m_Name) + " +" + (num2 - num).ToString(), null, HUDMessageIcon.None, string.Empty);
        }
    }
Beispiel #6
0
 private void HandleConnect(int connection_id, byte error)
 {
     if (P2PLogFilter.logDebug)
     {
         Debug.Log("P2PSession accepted client:" + connection_id);
     }
     if (error != 0)
     {
         if (this.Status == P2PSession.ESessionStatus.Connecting)
         {
             HUDMessages.Get().AddMessage(GreenHellGame.Instance.GetLocalization().Get("SessionInfo_ConnectionError", true), null, HUDMessageIcon.None, "", null);
         }
         this.OnConnectError(connection_id, error);
         return;
     }
     P2PSession.ESessionStatus status = this.Status;
     this.Status = P2PSession.ESessionStatus.Connected;
 }
Beispiel #7
0
    public override void OnEat(ConsumableInfo info)
    {
        base.OnEat(info);
        float   num     = UnityEngine.Random.Range(0f, 1f);
        Disease disease = PlayerDiseasesModule.Get().GetDisease(ConsumeEffect.DirtSickness);

        if (num < (float)disease.m_Level * 0.1f)
        {
            ParasiteSickness parasiteSickness = (ParasiteSickness)PlayerDiseasesModule.Get().GetDisease(ConsumeEffect.ParasiteSickness);
            if (parasiteSickness.IsActive())
            {
                parasiteSickness.IncreaseLevel(1);
            }
            else
            {
                PlayerDiseasesModule.Get().RequestDisease(ConsumeEffect.ParasiteSickness, 0f, 1);
            }
            HUDMessages.Get().AddMessage("+1 " + GreenHellGame.Instance.GetLocalization().Get("HUDMessage_ParasiteFromDirt", true), new Color?(Color.white), HUDMessageIcon.ParasiteSickness, string.Empty, this.m_IconIndexesTemp);
        }
    }
    private void TransferLiquids(LiquidType liquid_type, LiquidContainer from, ContainerData to)
    {
        LiquidContainerInfo liquidContainerInfo = (LiquidContainerInfo)from.m_Info;

        if (liquid_type != liquidContainerInfo.m_LiquidType)
        {
            if (to.m_Amount > 0f)
            {
                HUDMessages.Get().AddMessage(GreenHellGame.Instance.GetLocalization().Get("Liquids_Conflict", true), null, HUDMessageIcon.None, "", null);
                return;
            }
            this.SetCollectorLiquidType(liquidContainerInfo.m_LiquidType);
        }
        to.m_Amount += liquidContainerInfo.m_Amount;
        if (to.m_Amount > to.m_Capacity)
        {
            to.m_Amount = to.m_Capacity;
        }
        liquidContainerInfo.m_Amount = 0f;
        PlayerAudioModule.Get().PlayWaterSpillSound(1f, false);
    }
    private void TransferLiquids(LiquidType liquid_type, ContainerData from, LiquidContainer to)
    {
        LiquidContainerInfo liquidContainerInfo = (LiquidContainerInfo)to.m_Info;

        if (liquid_type != liquidContainerInfo.m_LiquidType)
        {
            if (liquidContainerInfo.m_Amount > 0f)
            {
                HUDMessages.Get().AddMessage(GreenHellGame.Instance.GetLocalization().Get("Liquids_Conflict", true), null, HUDMessageIcon.None, "", null);
                return;
            }
            liquidContainerInfo.m_LiquidType = liquid_type;
        }
        float num = liquidContainerInfo.m_Capacity - liquidContainerInfo.m_Amount;

        num = Mathf.Min(num, from.m_Amount);
        liquidContainerInfo.m_Amount += num;
        to.OnGet();
        from.m_Amount -= num;
        PlayerAudioModule.Get().PlayWaterSpillSound(1f, false);
    }
Beispiel #10
0
 public void OnAddMapArea()
 {
     HUDMessages.Get().AddMessage(GreenHellGame.Instance.GetLocalization().Get("MSG_Map_New_Location"), null, HUDMessageIcon.None, string.Empty);
     PlayerAudioModule.Get().PlayNotepadEntrySound();
 }
Beispiel #11
0
 private void OnTextChat(P2PNetworkMessage net_msg)
 {
     HUDMessages.Get().AddMessage(net_msg.m_Connection.m_Peer.GetDisplayName() + ": " + net_msg.m_Reader.ReadString(), null, HUDMessageIcon.None, "", null);
 }