Exemplo n.º 1
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomConnectorSerializer">A delegate to serialize custom connector JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <Connector> CustomConnectorSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("id", Id.ToString()),
                new JProperty("standard", Standard.ToString()),
                new JProperty("format", Format.ToString()),
                new JProperty("power_type", PowerType.ToString()),
                new JProperty("max_voltage", MaxVoltage),
                new JProperty("max_amperage", MaxAmperage),

                MaxElectricPower.HasValue
                               ? new JProperty("max_electric_power", MaxElectricPower.Value)
                               : null,

                TariffIds.SafeAny()
                               ? new JProperty("tariff_ids", new JArray(TariffIds.Select(tarifId => tarifId.ToString())))
                               : null,

                TermsAndConditionsURL.HasValue
                               ? new JProperty("terms_and_conditions", TermsAndConditionsURL.ToString())
                               : null,

                new JProperty("last_updated", LastUpdated.ToIso8601())

                );

            return(CustomConnectorSerializer != null
                       ? CustomConnectorSerializer(this, JSON)
                       : JSON);
        }
	public InventoryPower(PowerType type, bool infinite, string name = null){
		this.type = type;
		this.infinite = infinite;
		quantity = 1;
		if(name == null)
			this.name = type.ToString();
		else
			this.name = name;
	}
Exemplo n.º 3
0
        /// <summary>
        /// Return a text-representation of this object.
        /// </summary>
        public override String ToString()

        => new String[]
        {
            PowerType.HasValue?PowerType.ToString()         : "",
                    Voltage.HasValue ? Voltage.ToString() + " V"  : "",
                    Amperage.HasValue ? Amperage.ToString() + " A"  : "",
                    Power.HasValue ? Power.ToString() + " KW" : ""
        }

        .AggregateWith(",");
Exemplo n.º 4
0
 public virtual void PowerRedirect(PowerType powerType, string message)
 {
     if (this.PowerIsRedirect)
     {
         string str = this.LoginUrl + "?PowerExit=" + powerType.ToString() + "&PowerMessage=" + message.EncodeUrl();
         ("alert('" + message + "'); window.top.location='" + str + "';").RegisterScript(RegisterType.ClientBlock);
     }
     else
     {
         base.Response.Clear();
         base.Response.Write(message);
         base.Response.End();
     }
 }
Exemplo n.º 5
0
 public virtual void PowerRedirect(PowerType powerType)
 {
     if (this.PowerIsRedirect)
     {
         string str = this.LoginUrl + "?PowerExit=" + powerType.ToString();
         ("window.top.location='" + this.LoginUrl + "'").RegisterScript(RegisterType.ClientBlock);
     }
     else
     {
         base.Response.Clear();
         base.Response.Write("对不起你没有权限访问此界面");
         base.Response.End();
     }
 }
Exemplo n.º 6
0
 private void AddPowerToSystem(PowerType type)
 {
     //Check if the system can take more power
     if (UI_Power_Overlay.transform.FindChild(type.ToString()).GetComponent <Slider>().value >= 3)
     {
         //TODO Sound: Play invalid sound fx.
         return;
     }
     //If we don't have spare power, remove the first element.
     if (s_Power.Count >= m_MaxPower)
     {
         s_Power.RemoveAt(0);
         CmdRemoveAtSyncList(0);
     }
     s_Power.Add(type);
     CmdAddToSyncList((int)type);
 }
Exemplo n.º 7
0
    public void CmdSetPowerDistribution(PowerType type, int val)
    {
        Debug.Log("Power setting :" + type.ToString());
        switch (type)
        {
        case PowerType.Doors:
            _Power_Doors += val;
            break;

        case PowerType.Engines:
            _Power_Engines += val;
            break;

        case PowerType.Lights:
            _Power_Lights += val;
            break;

        case PowerType.MedBay:
            _Power_MedBay += val;
            break;

        case PowerType.Navigation:
            _Power_Navigation += val;
            break;

        case PowerType.Oxygen:
            _Power_Oxygen += val;
            break;

        case PowerType.Shields:
            _Power_Shields += val;
            break;

        case PowerType.Weapons:
            _Power_Weapons += val;
            break;
        }
    }
Exemplo n.º 8
0
    public PowersBehaviour GetPowerBehaviourPrefab(PowerType name)
    {
        PowersBehaviour objectLoaded = Resources.Load <PowersBehaviour>("Prefabs/Powers/PowersBehaviour/" + name.ToString() + "Behaviour");

        return(objectLoaded);
    }
Exemplo n.º 9
0
    public PowersEffect GetPowerEffectPrefab(PowerType name)
    {
        PowersEffect objectLoaded = Resources.Load <PowersEffect>("Prefabs/Powers/PowersEffect/" + name.ToString() + "Effect");

        return(objectLoaded);
    }
Exemplo n.º 10
0
 public string GetDescription()
 {
     return(powerType.ToString()[0] + cost.ToString());            //TODO Should use sprite instead
 }