예제 #1
0
        public Window AddWindow(ObjInfo item, bool adjust)
        {
            WinObjBase win = null;

            switch (item.Type)
            {
            case Text:
                win = new WinTextObj(item, dataManager, adjust);
                break;

            case PlainText:
                win = new WinPlainTextObj(item, adjust);
                break;

            case Bar:
                win = new WinBarObj(item, dataManager, adjust);
                break;

            case Pie:
                win = new WinCricleBarObj(item, dataManager, adjust);
                break;
            }
            if (item.Status != Enums.Status.Stoped)
            {
                win.Load();
                wins.Add(win, item);
                win.Show();
            }
            return(win);
        }
예제 #2
0
 public AreaCrossInfo(ObjInfo item)
 {
     this.ObjPtr = item.ObjPtr;
     this.ID     = item.ID;
     this.Pos.x  = (ushort)item.X;
     this.Pos.y  = (ushort)item.Y;
 }
예제 #3
0
 public SShrine(ObjInfo item)
 {
     this.ObjPtr = item.ObjPtr;
     this.ID     = item.ID;
     this.Pos.x  = (ushort)item.X;
     this.Pos.y  = (ushort)item.Y;
 }
예제 #4
0
    void GenerateObj(ObjInfo objInfo, Vector3 pos)
    {
        StageGimmick gimmick = StageGimmicksSO.i.gimmicks.Where(g => g.key == objInfo.key).FirstOrDefault();

        if (gimmick.gimmickObj == null)
        {
            return;
        }
        GameObject obj = Instantiate(gimmick.gimmickObj, pos, Quaternion.identity);

        //TODO:いつか直す
        switch (gimmick.key)
        {
        case "b":
            obj.GetComponent <BlockController>().OnInstantitate(objInfo.option);
            break;

        case "i":
            obj.GetComponent <ItemController>().OnInstantitate(objInfo.option);
            break;

        default:
            break;
        }
    }
예제 #5
0
 public void RefreshWindow(ObjInfo item)
 {
     isBusy = true;
     RemoveWindow(item);
     AddWindow(item, false);
     isBusy = false;
 }
예제 #6
0
    //////////////////////

    public ObjInfo AddObj(
        float x, float z,
        //float w, float h,
        UIWidget mb,//模板
        int depth
        )
    {
        ObjInfo n = new ObjInfo();

        n.id = m_IDSeed++;

        // n.width = w;
        // n.height = h;

        var newobj = GameObject.Instantiate(mb.gameObject);

        newobj.transform.parent     = this.transform;
        newobj.transform.localScale = Vector3.one;
        n.widget       = newobj.GetComponent <UIWidget>();
        n.widget.depth = depth;

        //加入到索引
        m_ObjsIndexByID.Add(n.id, n);


        //移动,刷新顶点位置
        MoveObj(n.id, x, z);

        return(n);
    }
예제 #7
0
    // 添加新的prefab
    private void AddPrefab(ObjInfo info)
    {
        if (info.obj == null)
        {
            Debug.Log("pool manager: attempt add null");
            return;
        }

        if (_pools.ContainsKey(info.obj.name))
        {
            Debug.Log($"pool manager: 尝试添加已存在的 {info.obj.name} prefab");
            return;
        }

        //用holder来管理池中的实例
        GameObject holder = new GameObject(info.obj.name + "Holder");

        holder.transform.SetParent(transform);

        Queue <GameObject> queue = new Queue <GameObject>();

        for (int i = 0; i < info.initCount; i++)
        {
            GameObject instance = Instantiate(info.obj, holder.transform, true);
            instance.SetActive(false);
            queue.Enqueue(instance);
        }

        _infoDict.Add(info.obj.name, info);
        _objHolders.Add(info.obj.name, holder);
        _pools.Add(info.obj.name, queue);
    }
예제 #8
0
    // Initialize our set of data
    void InitializeInfo()
    {
        _objInfo = new List <ObjInfo> [_objs.Length];

        for (int i = 0; i < _objs.Length; i++)
        {
            _objInfo[i] = new List <ObjInfo>();
        }

        for (int i = 0; i < _totalNumMeshes; i++)
        {
            float angle    = Random.Range(0.0f, Mathf.PI * 2.0f);
            float distance = Random.Range(10.0f, 50.0f);
            float height   = Random.Range(-2.0f, 2.0f);

            ObjInfo temp = new ObjInfo {
                objIndex    = Random.Range(0, _objs.Length),
                LODIndex    = -1,
                matrixIndex = i,
                position    = new Vector4(Mathf.Sin(angle) * distance, height, Mathf.Cos(angle) * distance, 1),
                color       = new Vector4(0, 0, 0, Random.Range(0.20f, 1.0f)),
                scale       = new Vector3(Random.Range(1.5f, 3.5f), Random.Range(1.5f, 3.5f), Random.Range(1.5f, 3.5f)),
                direction   = Vector3.Normalize(new Vector3(Random.Range(0, 1f), Random.Range(0, 1f), Random.Range(0, 1f)))
            };

            _objInfo[temp.objIndex].Add(temp);
        }
    }
예제 #9
0
        public void SaveFile()
        {
            ObjData[] objs = FindObjectsOfType <ObjData>(); //Identifies all objects in space
            LvlData   lvl  = new LvlData();                 //Creates variable for level file

            for (int d = 0; d < objs.Length; d++)
            {
                ObjInfo info = new ObjInfo();                  //Creates a save space for the object.
                info.objID    = objs[d].objID;                 //Sets the object's ID to the current for loop space
                info.position = objs[d].transform.position;    //Sets the object's position to the current for loop space
                info.rotation = objs[d].transform.eulerAngles; //Sets the object's rotation to the current for loop space
                info.scale    = objs[d].transform.localScale;  //Sets the object's scale to the current for loop space
                lvl.objInfo.Add(info);                         // Adds this object to the file.
            }

            string     fileLocation = Application.persistentDataPath + "/save.dat";
            FileStream file;

            if (File.Exists(fileLocation))
            {
                file = File.OpenWrite(fileLocation);
            }
            else
            {
                file = File.Create(fileLocation);
            }

            List <ObjInfo> safeData = new List <ObjInfo>(lvl.objInfo);

            BinaryFormatter binFo = new BinaryFormatter();

            binFo.Serialize(file, safeData);
            file.Close();
        }
예제 #10
0
 void SelectObj(GameObject obj)
 {
     if (GetAliveObj(obj) != null)
     {
         curSelectObj = GetAliveObj(obj);
         curSelectObj.Select();
     }
 }
예제 #11
0
 void _Move(ObjInfo n, float x, float z)
 {
     n.widget.transform.localPosition = new Vector3(
         x * m_Scale.x + m_Offset.x,
         (WorldSize.y - z) * m_Scale.y + m_Offset.y,
         0
         );
 }
예제 #12
0
 void UnSelectObj()
 {
     if (curSelectObj != null)
     {
         curSelectObj.UnSelect();
         curSelectObj = null;
     }
 }
예제 #13
0
 public SBox(ObjInfo item)
 {
     this.ObjPtr = item.ObjPtr;
     this.ID     = item.ID;
     this.Color  = item.Color;
     this.Pos.x  = (ushort)item.X;
     this.Pos.y  = (ushort)item.Y;
 }
예제 #14
0
 private void BossKilled()
 {
     if (Input.GetKey(KeyCode.Backspace) && Input.GetKey(KeyCode.LeftControl))
     {
         ObjInfo Boss = GameObject.Find(BossString).gameObject.GetComponent <ObjInfo>();
         Objs.Add(Boss);
     }
 }
예제 #15
0
 public void RemoveWindow(ObjInfo item)
 {
     if (wins.ContainsValue(item))
     {
         WinObjBase win = wins.First(p => p.Value == item).Key;
         RemoveWindow(win);
     }
 }
예제 #16
0
 public Form_EditPrice()
 {
     obj = new ObjInfo();
     InitializeComponent();
     CenterToParent();
     data = DataService.GetALLObjInfo();
     dataGridView1.DataSource = data;
     this.Show();
 }
예제 #17
0
 private void UpdateSelections()
 {
     selections = new List <ObjInfo>();
     Object[] objs = Selection.objects;
     for (int i = 0, count = objs.Length; i < count; i++)
     {
         ObjInfo temp = new ObjInfo(objs[i]);
         selections.Add(temp);
     }
 }
예제 #18
0
        public void Adjust(ObjInfo item)
        {
            isBusy = true;
            WinObjBase win       = wins.First(p => p.Value == item).Key;
            var        adjusting = win.Adjuesting;

            RemoveWindow(win);
            AddWindow(item, !adjusting);
            isBusy = false;
        }
 protected virtual void AddCompoments()
 {
     if (m_objInfo == null)
     {
         m_objInfo = Role.GetComponent <ObjInfo>();
         if (m_objInfo == null)
         {
             Role.AddComponent <ObjInfo>();
         }
     }
 }
    void DrawObjInfoList(ref Vector2 ScrollPos, Dictionary <int, ObjInfo> ObjInfoList, int nChooseID, bool isChar = false)
    {
        StartSpace(1);
        float height           = 30;
        int   ScrollViewheight = m_OneShowNum * 30 + 20;

        if (ScrollViewheight > 280)
        {
            ScrollViewheight = 280;
        }
        GUILayout.BeginHorizontal();
        ScrollPos = EditorGUILayout.BeginScrollView(ScrollPos, false, false, GUILayout.Height(ScrollViewheight));
        GUILayout.BeginVertical();

        int        nCurIndex = m_ShowOBJIndex;
        List <int> tKeys     = new List <int>(ObjInfoList.Keys);

        tKeys.Sort();
        int nStart = (nCurIndex - 1) * m_OneShowNum;
        int nEnd   = Mathf.Min(nCurIndex * m_OneShowNum, tKeys.Count);
        int nTotal = (int)Mathf.Ceil(tKeys.Count / (float)m_OneShowNum);

        for (int i = nStart; i < nEnd; i++)
        {
            ObjInfo info = null;
            int     id   = tKeys[i];
            ObjInfoList.TryGetValue(id, out info);
            string Buttonshow = "名字:\t" + info.name + "\t" + "ID:\t" + info.id;
            if (id != nChooseID)
            {
                height = 30;
            }
            else
            {
                height     = 60;
                Buttonshow = "当  前  选  中\n\n" + Buttonshow;
            }
            GUIContent b = new GUIContent(Buttonshow);
            b.text.PadRight(300);
            if (GUILayout.Button(b, GUILayout.Height(height)))
            {
                m_nChooseId = id;
            }
        }
        GUILayout.EndVertical();
        EditorGUILayout.EndScrollView();
        GUILayout.EndHorizontal();

        //EditorGUILayout.Space();
        nCurIndex      = EditorGUILayout.IntSlider(nCurIndex, 1, nTotal);
        m_ShowOBJIndex = nCurIndex;

        EndSpace();
    }
예제 #21
0
 //     public string Name=null;
 public SMonsterInfo(ObjInfo item)
 {
     this.ObjPtr   = item.ObjPtr;
     this.ID       = item.ID;
     this.EnemyID  = item.EnemyID;
     this.HP       = item.HP;
     this.MaxHP    = item.MaxHP;
     this.Priority = item.Color;
     this.Pos.x    = (ushort)item.X;
     this.Pos.y    = (ushort)item.Y;
 }
예제 #22
0
 public void SetStatue(ObjInfo item, Enums.Status statue)
 {
     if (wins.ContainsValue(item) && statue == Enums.Status.Stoped)
     {
         RemoveWindow(item);
     }
     else if ((!wins.ContainsValue(item)) && statue != Enums.Status.Stoped)
     {
         AddWindow(item, false);
     }
     item.Status = statue;
 }
    void SpawnObs9()
    {
        dist = 15f;
        Vector3    spawnPoint = new Vector3(469.945f, 15.398f, zPos);
        Quaternion spawnRot   = new Quaternion(0, 0, 0, 0);

        GameObject obs9Clone = Instantiate(obs9, spawnPoint, spawnRot);
        ObjInfo    objInfo   = obs9Clone.GetComponent <ObjInfo> ();

        objInfo.player  = player;
        obs9Clone.name  = "Plataforma" + (currentSpawn + 1).ToString();
        objInfo.nomeObj = "9";
    }
    void SpawnObs13()
    {
        Vector3    spawnPoint = new Vector3(469.945f, 15.398f, zPos);
        Quaternion spawnRot   = new Quaternion(-33.726f, 0, 0, 1);

        dist = 11.5f;

        GameObject obs13Clone = Instantiate(obs13, spawnPoint, spawnRot);
        ObjInfo    objInfo    = obs13Clone.GetComponent <ObjInfo> ();

        objInfo.player  = player;
        obs13Clone.name = "Plataforma" + (currentSpawn + 1).ToString();
        objInfo.nomeObj = "13";
    }
예제 #25
0
    ObjInfo[,] GetStageData(TextAsset stageDataCSV)
    {
        var stageDataStrList = CsvToStrList(stageDataCSV);
        var stageData        = new ObjInfo[stageDataStrList.Count, stageDataStrList[0].Length];

        for (int iy = stageData.GetLength(0) - 1; iy > -1; iy--)
        {
            for (int ix = 0; ix < stageData.GetLength(1); ix++)
            {
                stageData[stageData.GetLength(0) - 1 - iy, ix] = GetObjInfo(stageDataStrList[iy][ix]);
            }
        }
        return(stageData);
    }
예제 #26
0
    void InitializeObjsInfoList()
    {
        List <GameObject> wallsChild = new List <GameObject>();
        ObjInfo           toAdd;

        foreach (Transform dirDirChild in relativePosition.transform)
        {
            if (dirDirChild.name == "Walls")
            {
                foreach (Transform dirChild in dirDirChild.transform)
                {
                    foreach (Transform child in dirChild.transform)
                    {
                        if (child.tag == "Wall_X")
                        {
                            toAdd         = new ObjInfo();
                            toAdd.type    = 1;
                            toAdd.x_coord = (int)child.transform.localPosition.x;
                            toAdd.y_coord = (int)child.transform.localPosition.y;
                            board.objsInfoList.Add(toAdd);
                        }
                        else if (child.tag == "Wall_Y")
                        {
                            toAdd         = new ObjInfo();
                            toAdd.type    = 2;
                            toAdd.x_coord = (int)child.transform.localPosition.x;
                            toAdd.y_coord = (int)child.transform.localPosition.y;
                            board.objsInfoList.Add(toAdd);
                        }
                    }
                }
            }
            else if (dirDirChild.name == "Players")
            {
                foreach (Transform child in dirDirChild.transform)
                {
                    toAdd             = new ObjInfo();
                    toAdd.type        = 0;
                    toAdd.x_coord     = (int)child.transform.localPosition.x;
                    toAdd.y_coord     = (int)child.transform.localPosition.y;
                    toAdd.player_name = child.name;
                    board.objsInfoList.Add(toAdd);
                }
            }
        }
    }
    //
    private void FrontSightTriggerEvent()
    {
        localRotate = Model.transform.localRotation.y;
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        RaycastHit[] hits = Physics.RaycastAll(ray);
        foreach (RaycastHit hit in hits)
        {
            ObjInfo objinfo = hit.transform.gameObject.GetComponent <ObjInfo>();
            if (objinfo != null)
            {
                ColliderTypeEvent(objinfo.Type, hit.transform.gameObject);

                //如果為怪物或任務則立起
                if (objinfo.Type == EnemyTypeString || objinfo.Type == TaskTypeString)
                {
                    FrontSightImg.transform.rotation = new Quaternion(0, 0, 0, 0);
                }
                else
                {
                    FrontSightImg.transform.rotation = quaternion;
                }

                if (localRotate % 360 > 0 && localRotate % 360 <= 90)
                {
                    FrontSight.transform.position = new Vector3(hit.transform.position.x - FrontLength, hit.transform.position.y, hit.transform.position.z - FrontLength);
                }
                else if (localRotate % 360 > 90 && localRotate % 360 <= 180)
                {
                    FrontSight.transform.position = new Vector3(hit.transform.position.x - FrontLength, hit.transform.position.y, hit.transform.position.z + FrontLength);
                }
                else if (localRotate % 360 > 180 && localRotate % 360 <= 270)
                {
                    FrontSight.transform.position = new Vector3(hit.transform.position.x + FrontLength, hit.transform.position.y, hit.transform.position.z + FrontLength);
                }
                else if (localRotate % 360 > 270 && localRotate % 360 <= 360)
                {
                    FrontSight.transform.position = new Vector3(hit.transform.position.x + FrontLength, hit.transform.position.y, hit.transform.position.z - FrontLength);
                }
            }
            else
            {
                FrontSightImg.transform.rotation = quaternion;
            }
        }
    }
예제 #28
0
 /*
  * Rotates all of the positions inside our LOD sections, and recreates our
  * cached objectPosition list so that we can share object positions between
  * different render modes.
  */
 public void RotatePositions(int i)
 {
     if (_dataBuffer[i] != null)
     {
         for (int j = 0; j < _masterData[i].Count; j++)
         {
             // Set the positions of our instance based on our input List
             float   scaleMag = _masterData[i][j].scale.magnitude;
             Vector3 newPos   = Quaternion.AngleAxis(
                 scaleMag * Time.deltaTime,
                 Vector3.up) * _masterData[i][j].position;
             ObjInfo temp = _masterData[i][j];
             temp.position     = new Vector4(newPos.x, newPos.y, newPos.z, 1);
             _masterData[i][j] = temp;
         }
         _dataBuffer[i].SetData(_masterData[i]);
     }
 }
예제 #29
0
    ObjInfo GetObjInfo(string str)
    {
        //TODO:サイズを固定したい
        string[] datas = str.Split('_');

        //stringをそれぞれの型にパースする
        ObjInfo objInfo = new ObjInfo();

        objInfo.key = datas[0];
        if (objInfo.key == "")
        {
            return(objInfo);
        }

        if (int.TryParse(datas[1], out int option))
        {
            objInfo.option = option;
        }

        return(objInfo);
    }
예제 #30
0
    public void InitObjInfo(object[] ObjInfo)
    {
        //m_ObjInfoList;
        string[] sIdInfo = ObjInfo[0].ToString().Split(',');
        LuaTable tInfo   = (LuaTable)ObjInfo[1];

        for (int i = 0; i < sIdInfo.Length; i++)
        {
            string   sId      = sIdInfo[i];
            int      npcId    = int.Parse(sId);
            LuaTable tObjInfo = (LuaTable)tInfo[npcId];

            ObjInfo obj = new ObjInfo();
            if (tObjInfo != null)
            {
                obj.setInfo(sId, tObjInfo["ObjName"].ToString(), "1", tObjInfo["ModelName"].ToString());

                m_ObjInfoList.Add(npcId, obj);
            }
        }
    }
예제 #31
0
파일: Form1.cs 프로젝트: protain/SShared
        public Form1()
        {
            InitializeComponent();
            key_ = 0;

            Func<Object, bool> isJsObj = (o) => { return o is JavaScriptArray || o is JavaScriptObject; };
            jsoFunc = (o, klbl, tv, tn, isObj, lvl) =>
            {
                ++lvl;
                try {
                    if(o is JavaScriptArray) {
                        var jary = o as JavaScriptArray;
                        for(int i = 0; i < jary.Count; ++i) {
                            var lbl = "[" + i.ToString() + "]";
                            var tcn = new TreeNode(lbl);
                            if(isObj) {
                                tcn.ForeColor = Color.Red;
                            }
                            tcn.Tag = new ObjInfo { idx_ = isObj ? i : -1, pdfObj_ = jary[i] as JavaScriptObject };
                            if(!isJsObj(jary[i])) {
                                lbl = lbl + " : " + (jary[i] == null ? "null" : jary[i].ToString());
                                tcn.Text = lbl;
                                if(tv == null) tn.Nodes.Add(tcn); else tv.Nodes.Add(tcn);
                            }
                            else {
                                if(tv == null) tn.Nodes.Add(tcn); else tv.Nodes.Add(tcn);
                                jsoFunc(jary[i], "", null, tcn, (lvl == 1 && i == 1), lvl);
                            }
                        }
                    }
                    else if(o is JavaScriptObject) {
                        var jobj = o as JavaScriptObject;
                        foreach(var key in jobj.Keys) {
                            if(isJsObj(jobj[key])) {
                                var tcn = new TreeNode(key);
                                var objinf = new ObjInfo { idx_ = -1, pdfObj_ = jobj[key] as JavaScriptObject };
                                if(jobj.ContainsKey("$ContentsNo")) {
                                    objinf.idx_ = Convert.ToInt32(jobj["$ContentsNo"]);
                                }
                                else if(jobj.ContainsKey("$ResourcesNo")) {
                                    objinf.idx_ = Convert.ToInt32(jobj["$ResourcesNo"]);
                                }
                                tcn.Tag = objinf;
                                if(tv == null) tn.Nodes.Add(tcn); else tv.Nodes.Add(tcn);
                                jsoFunc(jobj[key], key, null, tcn, false, lvl);
                            }
                            else {
                                var tcn = new TreeNode(key + " : " + (jobj[key] == null ? "null" : jobj[key].ToString()));
                                if(tv == null) tn.Nodes.Add(tcn); else tv.Nodes.Add(tcn);
                            }
                        }
                    }
                    else {
                        var vstr = o == null ? "null" : o.ToString();
                        var lbl = "";
                        if(string.IsNullOrEmpty(klbl)) lbl = klbl + " : " + vstr; else lbl = vstr;
                        var tcn = new TreeNode(lbl);
                        if(tv == null) tn.Nodes.Add(tcn); else tv.Nodes.Add(tcn);
                    }
                }
                finally {
                    --lvl;
                }
            };
        }