Exemple #1
0
 public IRenderObj GetWeapon()
 {
     for (int i = 0; i < m_lstSuitData.Count; i++)
     {
         SuitData data = m_lstSuitData[i];
         if (data.info.pos == SuitPos.Weapon)
         {
             return(data.obj);
         }
     }
     return(null);
 }
Exemple #2
0
 private void CheckAllRanges(SuitData ndt)
 {
     if (CheckValueRange(ndt.heart_bpm, m_HeartRateLow, m_HeartRateLow))
     {
         Debug.Log("Heart Rate going hardcore");
     }
     if (CheckValueRange(ndt.p_suit, m_P_SuitLow, m_P_SuitHigh))
     {
         Debug.Log("Suit Pressure Bad, fix it");
     }
     if (CheckValueRange(ndt.p_sub, m_P_SubLow, m_P_SubHigh))
     {
         Debug.Log("Outside Pressure Crazy, the world is ending");
     }
     if (CheckValueRange(ndt.t_sub, m_T_SubLow, m_T_SubHigh))
     {
         Debug.Log("Outside Temperature is Crazy, the universe is probably breaking");
     }
     if (CheckValueRange(ndt.v_fan, m_V_FanLow, m_V_FanHigh))
     {
         Debug.Log("Fan Rotation not right, get working on spinning that out");
     }
     if (CheckValueRange(ndt.p_o2, m_P_O2Low, m_P_O2High))
     {
         Debug.Log("O2 pressure not right, breathe drastically and heavily");
     }
     if (CheckValueRange(ndt.rate_o2, m_Rate_O2Low, m_Rate_O2High))
     {
         Debug.Log("O2 rate is wrong, the flow ain't flowing");
     }
     if (CheckValueRange(ndt.cap_battery, m_Cap_BatteryLow, m_Cap_BatteryHigh))
     {
         Debug.Log("Battery is low, lights are about to go out");
     }
     if (CheckValueRange(ndt.p_h2o_g, m_P_H2O_GLow, m_P_H2O_GHigh))
     {
         Debug.Log("Gas of H2O pressure is bad, that's probably not good");
     }
     if (CheckValueRange(ndt.p_h2o_l, m_P_H2O_LLow, m_P_H2O_LHigh))
     {
         Debug.Log("Liquid of H2O pressure is bad, woops...");
     }
     if (CheckValueRange(ndt.p_sop, m_P_SOPLow, m_P_SOPHigh))
     {
         Debug.Log("SOP is bad, thats no good");
     }
     if (CheckValueRange(ndt.rate_sop, m_Rate_SOPLow, m_Rate_SOPHigh))
     {
         Debug.Log("Rate of SOP is bad, sorry about that");
     }
 }
Exemple #3
0
    //根据套装ID获取套装属性
    public SuitData GetSuitData(int suitID)
    {
        List <SuitData> suits = GetSuitDatas();

        for (int i = 0; i < suits.Count; i++)
        {
            SuitData suit = suits[i];
            if (suitID == suit.Id)
            {
                return(suit);
            }
        }
        return(null);
    }
Exemple #4
0
    /// <summary>
    /// 计算装备的加成数据, 每次当数据发生改变的时候调用
    /// </summary>
    void UpdateAdditionData()
    {
        this.addAtk   = 0;
        this.addDef   = 0;
        this.addThump = 0;
        this.addHp    = 0;
        this.addMp    = 0;
        this.addAnger = 0;
        this.suits    = new List <SuitData>();//套装加成
        //把每一件装备的加成数据加给实际的数据
        for (int i = 0; i < items.Count; i++)
        {
            EquipmentData item = items[i];
            this.addAtk   += item.Atk;
            this.addDef   += item.Def;
            this.addThump += item.Thump;
            this.addHp    += item.Hp;
            this.addMp    += item.Mp;
            this.addAnger += item.Anger;

            SuitData suitData = DataBase.Instance.GetSuitData(item.SuitID);
            //是套装的部件
            if (null != suitData)
            {
                int numHas = GetNumberOfComponentForSuit(item.SuitID).Count;
                int num    = DataBase.Instance.GetNumberOfComponentForSuit(item.SuitID).Count;
                //组成套装了
                if (numHas == num)
                {
                    //并且还没有增加过该套装属性,则增加套装属性
                    if (!this.IsAddSuit(suitData.Id))
                    {
                        this.addAtk   += suitData.Atk;
                        this.addDef   += suitData.Def;
                        this.addThump += suitData.Thump;
                        this.addHp    += suitData.Hp;
                        this.addMp    += suitData.Mp;
                        this.addAnger += suitData.Anger;
                        this.suits.Add(suitData);
                    }
                }
            }
        }
    }
Exemple #5
0
    public void SetModel(List <SuitData> suitData, int job, uint faceId)
    {
        int sex = 0;

        sex = (int)GameUtil.FaceToSex(faceId);

        rtGo.SetActive(true);

        if (suitData == null)//机器人无时装数据
        {
            suitData = new List <SuitData>();
            SuitData sd = new SuitData {
                baseid = 0, suit_type = EquipSuitType.Unknow_Type
            };
            suitData.Add(sd);
        }

        if (rtObj != null)
        {
            rtObj.Release();
        }
        rtObj = DataManager.Manager <RenderTextureManager>().CreateRenderTextureObj(suitData, job, sex, 700);
        if (rtObj == null)
        {
            return;
        }

        UIRenderTexture rt = rtGo.GetComponent <UIRenderTexture>();

        if (rt == null)
        {
            rt = rtGo.AddComponent <UIRenderTexture>();
        }
        rtObj.SetModelRotateY(180);
        rtObj.SetModelScale(1f);
        rtObj.SetCamera(new Vector3(0, 1f, 0f), new Vector3(15, 0, 0), 4f);
        rt.SetDepth(3);
        rt.Initialize(rtObj, 180f, new UnityEngine.Vector2(600f, 600f));
        rtObj.PlayModelAni(Client.EntityAction.Stand);
    }
Exemple #6
0
    private void UpdateUI(SuitData data)
    {
        float waterHours   = float.Parse(data.t_water.Split(':')[0]);
        float oxygenHours  = float.Parse(data.t_oxygen.Split(':')[0]);
        float batteryHours = float.Parse(data.t_battery.Split(':')[0]);

        CheckOffNominalRange("Internal Suit Pressure", data.p_suit, 2.0f, 4.0f, "psid");
        CheckOffNominalRange("Time Life Battery", batteryHours, 0.0f, 10.0f, "hours");
        CheckOffNominalRange("Time Life Oxygen", oxygenHours, 0.0f, 10.0f, "hours");
        CheckOffNominalRange("Time Life Water", waterHours, 0.0f, 10.0f, "hours");
        CheckOffNominalRange("SUB Pressure", data.p_sub, 2.0f, 4.0f, "psia");
        CheckOffNominalRange("SUB Tempurature", data.t_sub, -148.0f, 248.0f, "° F");
        CheckOffNominalRange("Fan Tachometer", data.v_fan, 10000.0f, 40000.0f, "RPM");
        CheckOffNominalRange("Extravehicular Activity Rate", data.p_o2, 0.0f, 9.0f, "hours");
        CheckOffNominalRange("Oxygen Pressure", data.p_o2, 750.0f, 950.0f, "psia");
        CheckOffNominalRange("Oxygen Rate", data.rate_o2, 0.5f, 1.0f, "psi/min");
        CheckOffNominalRange("Battery Capacity", data.cap_battery, 0.0f, 30.0f, "ah");
        CheckOffNominalRange("H20 Gas Pressure", data.p_h2o_g, 14.0f, 16.0f, "psia");
        CheckOffNominalRange("H20 Liquid Pressure", data.p_h2o_l, 14.0f, 16.0f, "psia");
        CheckOffNominalRange("SOP Pressure", data.p_sop, 750.0f, 950.0f, "psia");
        CheckOffNominalRange("SOP Rate", data.rate_sop, 0.5f, 1.0f, "psi/min");

        m_SuitDataUIElements[0].SetData("Internal Suit Pressure", data.p_suit, 2.0f, 4.0f, "psid");
        m_SuitDataUIElements[1].SetData("Time Life Battery", batteryHours, 0.0f, 10.0f, "hours");
        m_SuitDataUIElements[2].SetData("Time Life Oxygen", oxygenHours, 0.0f, 10.0f, "hours");
        m_SuitDataUIElements[3].SetData("Time Life Water", waterHours, 0.0f, 10.0f, "hours");
        m_SuitDataUIElements[4].SetData("SUB Pressure", data.p_sub, 2.0f, 4.0f, "psia");
        m_SuitDataUIElements[5].SetData("SUB Tempurature", data.t_sub, -148.0f, 248.0f, "° F");
        m_SuitDataUIElements[6].SetData("Fan Tachometer", data.v_fan, 10000.0f, 40000.0f, "RPM");
        m_SuitDataUIElements[7].SetData("Extravehicular Activity Rate", data.p_o2, 0.0f, 9.0f, "hours");
        m_SuitDataUIElements[8].SetData("Oxygen Pressure", data.p_o2, 750.0f, 950.0f, "psia");
        m_SuitDataUIElements[9].SetData("Oxygen Rate", data.rate_o2, 0.5f, 1.0f, "psi/min");
        m_SuitDataUIElements[10].SetData("Battery Capacity", data.cap_battery, 0.0f, 30.0f, "ah");
        m_SuitDataUIElements[11].SetData("H20 Gas Pressure", data.p_h2o_g, 14.0f, 16.0f, "psia");
        m_SuitDataUIElements[12].SetData("H20 Liquid Pressure", data.p_h2o_l, 14.0f, 16.0f, "psia");
        m_SuitDataUIElements[13].SetData("SOP Pressure", data.p_sop, 750.0f, 950.0f, "psia");
        m_SuitDataUIElements[14].SetData("SOP Rate", data.rate_sop, 0.5f, 1.0f, "psi/min");
    }
Exemple #7
0
    public bool IsPlayerEquipCloth(IPlayer player, out uint suitID)
    {
        suitID = 0;
        if (player == null)
        {
            return(false);
        }
        List <GameCmd.SuitData> suitList = null;

        player.GetSuit(out suitList);
        bool bEquip = false;

        if (suitList != null)
        {
            for (int i = 0; i < suitList.Count; i++)
            {
                SuitData data = suitList[i];
                if (data.suit_type == EquipSuitType.Clothes_Type)
                {
                    suitID = data.baseid;
                    if (data.baseid != 0)
                    {
                        SuitDataBase sdb = GameTableManager.Instance.GetTableItem <SuitDataBase>(data.baseid);
                        if (sdb != null)
                        {
                            if (sdb.typeMask == 1)
                            {
                                return(true);
                            }
                        }
                    }
                }
            }
        }
        return(false);
    }
Exemple #8
0
/*
 *  IEnumerator RunStartWWW()
 *  {
 *      weCanQuit = true;
 *      using (UnityWebRequest www = UnityWebRequest.Get("https://agile-badlands-39994.herokuapp.com/api/start-sim"))
 *      {
 *          yield return www.SendWebRequest();
 *      }
 *  }
 *
 *  IEnumerator RunStopWWW()
 *  {
 *      using (UnityWebRequest www = UnityWebRequest.Get("https://agile-badlands-39994.herokuapp.com/api-stop-sim"))
 *      {
 *          yield return www.SendWebRequest();
 *      }
 *  }
 */
    IEnumerator RunWWW()
    {
        if (m_bGettingSuitData == true)
        {
            yield break;
        }

        using (UnityWebRequest www = UnityWebRequest.Get(url))
        {
            yield return(www.SendWebRequest());

            m_bGettingSuitData = true;
            string json = "";
            if (www.isNetworkError)
            {
                bioText.text       = "NETWORK ERROR Not connected to server :(\n";
                bioText.text      += www.error;
                m_bGettingSuitData = false;
            }
            else if (www.isHttpError)
            {
                bioText.text       = "HTTP ERROR Not connected to server :( :( :(";
                bioText.text      += www.error;
                m_bGettingSuitData = false;
            }
            else
            {
                // We are connected to the server

                // Use line below only if the JSON comes in with brackets around it
                //json = RemoveBrackets(www.downloadHandler.text);
                json = www.downloadHandler.text;
                m_bGettingSuitData = false;

                //Debug.Log("Connected to biometrics server");
            }

            if (!json.Equals(""))
            {
                json = json.Substring(1, json.Length - 2);

                SuitData jsonObject = JsonUtility.FromJson <SuitData>(json);
                //LineData data = new LineData();

                //data.m_DataValue = jsonObject.v_fan;
                //data.m_Time = Time.time;

                //lineGraph.AddLineDataPoint(data);
                //Debug.Log("Parsing");
                UpdateUI(jsonObject);

                // Get the lesser time between oxygen and battery
                string identifier = "";
                string lesserTime = getLesserTime(jsonObject.t_oxygen, jsonObject.t_battery, out identifier);

                // Display Time Left
                timeLeftText.text  = "Time Left: " + lesserTime + " (" + identifier + ")";
                m_bGettingSuitData = false;

                m_BiometricInCautionElement.SetActive(WarningSingleton.m_Singleton.m_DataInWarning);
            }
            else
            {
                Debug.Log("no data recieved from the server");
                m_bGettingSuitData = false;
            }
        }
    }
Exemple #9
0
    /// <summary>
    /// 钓鱼,使用鱼竿
    /// </summary>
    public void OnFishingRodSuit(IEntity en)
    {
        enumProfession job    = (enumProfession)en.GetProp((int)PlayerProp.Job);
        uint           suitid = 0;

        switch (job)
        {
        //战士
        case enumProfession.Profession_Soldier:
            suitid = 2521;
            break;

        //幻师
        case enumProfession.Profession_Spy:
            int statues = en.GetProp((int)PlayerProp.SkillStatus);
            //魔医形态用战士的时装id
            if (statues == 1)
            {
                suitid = 2522;
            }
            else
            {
                suitid = 2522;
            }
            break;

        //法师
        case enumProfession.Profession_Freeman:
            suitid = 2523;
            break;

        //暗巫
        case enumProfession.Profession_Doctor:
            suitid = 2524;
            break;
        }
        IPlayer player = en as IPlayer;

        if (player == null)
        {
            return;
        }

        //需要保存的suitId
        uint saveSuitId = 0;

        List <GameCmd.SuitData> suitList = null;

        player.GetSuit(out suitList);
        if (suitList != null)
        {
            for (int i = 0; i < suitList.Count; i++)
            {
                SuitData data = suitList[i];
                if (data.suit_type == EquipSuitType.Qibing_Type)
                {
                    //if (data.baseid != 0)
                    {
                        //CurWeaponSuitID = data.baseid;
                        saveSuitId = data.baseid;
                    }
                }
            }
        }

        if (m_playerSuitDic.ContainsKey(player.GetID()))
        {
            m_playerSuitDic.Remove(player.GetID());
        }
        m_playerSuitDic.Add(player.GetID(), saveSuitId);

        //鱼竿数据
        if (m_playerFishingDic.ContainsKey(player.GetID()))
        {
            m_playerFishingDic.Remove(player.GetID());
        }
        m_fishingPlayerId = player.GetID();

        SendChangeBody(2, suitid, player);
        SendChangeRenderObj(suitid, 2, player.GetID());
    }
Exemple #10
0
    public void OnMiningTreasureMapToChangeWeapon(IEntity en)
    {
        enumProfession job    = (enumProfession)en.GetProp((int)PlayerProp.Job);
        uint           suitid = 0;

        switch (job)
        {
        //战士
        case enumProfession.Profession_Soldier:
            suitid = 2511;
            break;

        //幻师
        case enumProfession.Profession_Spy:
            int statues = en.GetProp((int)PlayerProp.SkillStatus);
            //魔医形态用战士的时装id
            if (statues == 1)
            {
                suitid = 2512;
            }
            else
            {
                suitid = 2511;
            }
            break;

        //法师
        case enumProfession.Profession_Freeman:
            suitid = 2513;
            break;

        //暗巫
        case enumProfession.Profession_Doctor:
            suitid = 2514;
            break;
        }
        IPlayer player = en as IPlayer;

        if (player == null)
        {
            return;
        }
        List <GameCmd.SuitData> suitList = null;

        player.GetSuit(out suitList);
        if (suitList != null)
        {
            for (int i = 0; i < suitList.Count; i++)
            {
                SuitData data = suitList[i];
                if (data.suit_type == EquipSuitType.Qibing_Type)
                {
                    if (data.baseid != 0)
                    {
                        CurWeaponSuitID = data.baseid;
                    }
                }
            }
        }
        SendChangeBody(2, suitid, player);
        SendChangeRenderObj(suitid, 2, player.GetID());
    }