コード例 #1
0
    public KeyCodeDropdownList(int keycode)
    {
        PopulateValues();

        dW = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(DropdownWrapper));
        ReturnDropdownWrapper().dropdown.AddOptions(inputNames);

        for (int i = 0; i < inputValues.Length; i++)
        {
            if (keycode == inputValues[i])
            {
                ReturnDropdownWrapper().dropdown.value = i;
            }
        }
    }
コード例 #2
0
        protected override TEntity?GetOriginalItem(DateTime?moment)
        {
            if (ParentProperty?.PropertyType != PropertyType.Lookup)
            {
                throw new NotSupportedException("You cannot use GetOriginalItem on a property thats not a lookup.");
            }

            LazyLoad();
            if (!moment.HasValue)
            {
                moment = RunningTransaction.TransactionDate;
            }

            return(LoadedData.Where(item => item.Overlaps(moment.Value)).Select(item => item.Item).FirstOrDefault());
        }
コード例 #3
0
    void ChangeButtonMode(AbilityButtonMode mode)
    {
        currMode = mode;

        switch (currMode)
        {
        case AbilityButtonMode.CHANGE_PRIMARY_CHARACTER:
            LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Text>(commandText).text = "Select ability to be new primary character.";
            break;

        default:
            LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Text>(commandText).text = "";
            break;
        }
    }
コード例 #4
0
ファイル: AgentData.cs プロジェクト: gkjolin/Uniy2017_ToLua
    static public void LoadHandler(LoadedData data)
    {
        JsonData jsonData = JsonMapper.ToObject(data.Value.ToString());

        if (!jsonData.IsArray)
        {
            return;
        }
        for (int index = 0; index < jsonData.Count; index++)
        {
            JsonData element = jsonData[index];
            AgentPO  po      = new AgentPO(element);
            AgentData.Instance.m_dictionary.Add(po.Id, po);
        }
    }
コード例 #5
0
    // Update is called once per frame
    void Update()
    {
        string text = "Datafiles: " + cDT.sentFiles.ToString() + "/" + cDT.expectedFiles.ToString() + "\n";

        text += "Art Assets: " + iDT.sentFiles.ToString() + "/" + iDT.expectedFiles.ToString() + "\n";
        text += "Manifest: " + mE.sentData.ToString() + "/" + mE.expectedDataCount.ToString() + "\n";

        text += LoadedData.GetCurrentTimestamp();
        LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Text>(progressOfFiles).text = text;

        if (cDT.sentFiles == cDT.expectedFiles && iDT.sentFiles == iDT.expectedFiles && startInitiated && mE.expectedDataCount == mE.sentData)
        {
            SceneTransitionData.LoadScene("Gameplay");
        }
    }
コード例 #6
0
ファイル: LoadingManager.cs プロジェクト: 737871854/UIFrame
        private void onLoadHandler(LoadedData data)
        {
            Log.Hsz(data.FilePath + " LoadOver!");

            if (tobeLoadInfoQueue.Count == 0)
            {
                //if (showProgress)
                //{
                //    UI_View.UpdateProgress(totalCount);
                //    UI_View.Show(false);
                //}
                if (curLoadInfo != null && curLoadInfo.OnLoadHandler != null)
                {
                    curLoadInfo.OnLoadHandler(data);
                    curLoadInfo = null;
                }

                if (completeHandler != null)
                {
                    completeHandler();
                    Log.Hsz("Load Complete!");
                }
            }
            else
            {
                //if (showProgress)
                //{
                //    UI_View.UpdateProgress(totalCount - tobeLoadInfoQueue.Count);
                //}

                //调用一下外部的回调;
                if (curLoadInfo != null && curLoadInfo.OnLoadHandler != null)
                {
                    curLoadInfo.OnLoadHandler(data);
                }

                //继续加载下一个;
                curLoadInfo = tobeLoadInfoQueue.Dequeue();
                if (curLoadInfo.XmlResolver != null)
                {
                    ResManager.Instance.LoadXML(curLoadInfo.Path, onLoadHandler, curLoadInfo.XmlResolver);
                }
                else
                {
                    ResManager.Instance.LoadRes(curLoadInfo.Path, onLoadHandler);
                }
            }
        }
コード例 #7
0
        protected override TEntity?GetOriginalItem(DateTime?moment)
        {
            if (ParentProperty?.PropertyType != PropertyType.Lookup)
            {
                throw new NotSupportedException("You cannot use GetOriginalItem on a property thats not a lookup.");
            }

            LazyLoad();

            if (LoadedData.Count() == 0)
            {
                return(default(TEntity));
            }

            return(LoadedData.First().Item);
        }
コード例 #8
0
    public bool CheckIfReferenced(int nodeId, int variableId)
    {
        if (nodes[nodeId] == null)
        {
            return(false);
        }

        bool notInstanced = LoadedData.GetVariableType(subclassTypes[nodeId], variableId, VariableTypes.NON_INSTANCED);

        if (notInstanced || !instancedNodes.ContainsKey(nodeId) || instancedNodes[nodeId] == null)
        {
            return(false);
        }

        return(true);
    }
コード例 #9
0
        public List <StockViewModel> GetData()
        {
            string url = "https://www.quandl.com/api/v3/datasets/EOD/{0}?start_date=2018-11-20&end_date=2018-11-20&api_key={1}";

            // Choose any tickers you want
            List <string> tickers = new List <string> {
                "MSFT", "IBM", "AAPL"
            };

            // This holds all the data
            List <StockViewModel> objList = new List <StockViewModel>();

            using (WebClient wc = new WebClient())
            {
                // Loop through all ticker symbols
                foreach (var item in tickers)
                {
                    string       currUrl = String.Format(url, item, apiKey);
                    var          json    = wc.DownloadString(currUrl);
                    RegexOptions options = RegexOptions.IgnoreCase | RegexOptions.Singleline;
                    Regex        regx    = new Regex("<code data-language=\"ruby\">(?<theBody>.*)</code>", options);
                    Match        match   = regx.Match(json);

                    if (match.Success)
                    {
                        string     theBody    = match.Groups["theBody"].Value;
                        LoadedData parsedData = JsonSerializer.Deserialize <LoadedData>(theBody);
                        dynamic    d1         = parsedData.dataset.data;
                        if (d1 is object[] d2 && d2.Length > 0)
                        {
                            DateTime date       = DateTime.Parse(d1[0][0].ToString());
                            double   closeprice = Convert.ToDouble(d1[0][4].ToString());
                            double   volume     = Convert.ToDouble(d1[0][5].ToString());
                            // We have our data. Add it to the list
                            objList.Add(new StockViewModel
                            {
                                dateTime = date.ToShortDateString(),
                                ticker   = item,
                                close    = closeprice.ToString(),
                                volume   = volume.ToString()
                            });
                        }
                    }
                }
            }
            return(objList);
        }
コード例 #10
0
    public void SendEncodedMessages()
    {
        byte[] eT    = BitConverter.GetBytes(encoderId);
        byte[] cId   = BitConverter.GetBytes(ClientProgram.clientId);
        byte[] tS    = BitConverter.GetBytes(LoadedData.GetCurrentTimestamp());
        byte[] nwMsg = new byte[bytesToSend.Length + 16];

        Buffer.BlockCopy(eT, 0, nwMsg, 0, 4);
        Buffer.BlockCopy(cId, 0, nwMsg, 4, 4);
        Buffer.BlockCopy(tS, 0, nwMsg, 8, 8);
        Buffer.BlockCopy(bytesToSend, 0, nwMsg, 16, bytesToSend.Length);

        if (ClientProgram.clientInst != null)
        {
            ClientProgram.clientInst.AddNetworkMessage(nwMsg);
        }
    }
コード例 #11
0
ファイル: Saving.cs プロジェクト: ofsouzap/PokemonObsidian
    public static void LaunchLoadedData(LoadedData data)
    {
        if (data.status != LoadedData.Status.Success)
        {
            Debug.LogError("Data isn't loaded successfully");
        }

        PlayerData.singleton = data.playerData;

        FreeRoaming.PlayerController.singleton.RefreshSpriteFromPlayerData();

        GameSettings.singleton = data.gameSettings;

        MusicSourceController.singleton.SetVolume(GameSettings.singleton.musicVolume);

        GameSceneManager.LoadSceneStack(data.sceneStack);
    }
コード例 #12
0
    public void CreateWindowForAdditionalOptions()
    {
        if (additionalOptions == null)
        {
            additionalOptions = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(WindowsWrapper)).script as WindowsWrapper;
            additionalOptions.ChangeWindowsContentSize(new Vector2(400, 500));
            additionalOptions.windowsText.text = "Additional Options";

            LinearLayout mainAddOptionsLL = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(LinearLayout)).script as LinearLayout;
            mainAddOptionsLL.transform.SetParent(additionalOptions.content.transform);
            mainAddOptionsLL.transform.localPosition = new Vector3();
        }
        else
        {
            additionalOptions.gameObject.SetActive(true);
        }
    }
コード例 #13
0
        /// <inheritdoc />
        public void LoadDirectory(ResourcePath path)
        {
            var sawmill = Logger.GetSawmill("eng");

            _hasEverBeenReloaded = true;
            var yamlStreams = _resources.ContentFindFiles(path).ToList().AsParallel()
                              .Where(filePath => filePath.Extension == "yml" && !filePath.Filename.StartsWith("."))
                              .Select(filePath =>
            {
                try
                {
                    using var reader = new StreamReader(_resources.ContentFileRead(filePath), EncodingHelpers.UTF8);
                    var yamlStream   = new YamlStream();
                    yamlStream.Load(reader);

                    var result = ((YamlStream? yamlStream, ResourcePath?))(yamlStream, filePath);

                    LoadedData?.Invoke(yamlStream, filePath.ToString());

                    return(result);
                }
                catch (YamlException e)
                {
                    sawmill.Error("YamlException whilst loading prototypes from {0}: {1}", filePath, e.Message);
                    return(null, null);
                }
            })
                              .Where(p => p.yamlStream != null) // Filter out loading errors.
                              .ToList();

            foreach (var(stream, filePath) in yamlStreams)
            {
                for (var i = 0; i < stream.Documents.Count; i++)
                {
                    try
                    {
                        LoadFromDocument(stream.Documents[i]);
                    }
                    catch (Exception e)
                    {
                        Logger.ErrorS("eng", $"Exception whilst loading prototypes from {filePath}#{i}:\n{e}");
                    }
                }
            }
        }
コード例 #14
0
    public override void OnSpawn()
    {
        if (scrollRect == null)
        {
            scrollRect = GetComponent <ScrollRect>();
        }

        scrollRect.horizontal   = false;
        scrollRect.vertical     = true;
        scrollRect.movementType = ScrollRect.MovementType.Elastic;


        // Main image.
        mainImage = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(Image)).script as Image;

        // Image used for content ect.
        contentImage = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(Image)).script as Image;
        scrollBar    = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(ScrollbarWrapper)).script as ScrollbarWrapper;

        content = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(UIMule)).script as UIMule;
        contentImage.gameObject.AddComponent <Mask>();

        content.GetRectTransform().pivot = new Vector3(0.5f, 1);
        content.GetRectTransform().SetParent(contentImage.transform);
        mainImage.transform.SetParent(scrollRect.transform);
        contentImage.transform.SetParent(scrollRect.transform);
        scrollBar.transform.SetParent(scrollRect.transform);

        (contentImage.transform as RectTransform).sizeDelta = new Vector2(100, 150);
        scrollBar.transform.localPosition = new Vector2(60, 0);
        //sBW.transform.localPosition = new Vector3(300,0);

        scrollRect.viewport          = contentImage.rectTransform;
        scrollRect.content           = content.GetRectTransform();
        scrollRect.verticalScrollbar = scrollBar.scriptsData[0].script as Scrollbar;
        //AllignWrapperElements();

        scriptsData = new AdditionalScriptData[] {
            new AdditionalScriptData("ScrollRect", scrollRect),
            new AdditionalScriptData("MainImage", mainImage),
            new AdditionalScriptData("ContentImage", contentImage),
            new AdditionalScriptData("Scrollbar", scrollBar),
            new AdditionalScriptData("Content", content)
        };
    }
コード例 #15
0
    public void BuildAbility(int targetId)
    {
        int latestEntry = builders[targetId].byteData.Count - 1;

        string abilityId          = Encoding.Default.GetString(builders[targetId].byteData[latestEntry - 2]);
        string abilityNodeData    = Encoding.Default.GetString(builders[targetId].byteData[latestEntry - 1]);
        string abilityDescription = Encoding.Default.GetString(builders[targetId].byteData[latestEntry]);

        AbilityDataSubclass[] ability = LoadedData.GetSingleton <JSONFileConvertor>().ConvertToData(JsonConvert.DeserializeObject <StandardJSONFileFormat[]>(abilityNodeData));

        if (ability == null)
        {
            return;
        }

        AbilityInfo aD = JsonConvert.DeserializeObject <AbilityInfo>(abilityDescription);

        AbilitiesManager.aData[targetId].abilties[abilityId] = new AbilityData(ability, aD, targetId, abilityId);
    }
コード例 #16
0
    public AbilityTreeNode CreateNewNodeIfNull(int nodeId)
    {
        //Debug.Log(nodeId);
        if (!nodes[nodeId])
        {
            // Tries to convert type into a singleton to see if it exist.
            if (LoadedData.singletonList.ContainsKey(subclassTypes[nodeId]))
            {
                nodes[nodeId] = LoadedData.singletonList[subclassTypes[nodeId]] as AbilityTreeNode;
            }

            if (nodes[nodeId] == null)
            {
                SpawnerOutput sOInst = LoadedData.GetSingleton <Spawner>().CreateScriptedObject(subclassTypes[nodeId]);
                nodes[nodeId] = sOInst.script as AbilityTreeNode;
                nodes[nodeId].SetSourceObject(sOInst);

                // Changes its name
                nodes[nodeId].name = castingPlayer.ToString() + '/' + centralId.ToString() + '/' + nodeId.ToString();

                // Adds it to root
                nodes[nodeId].transform.SetParent(abilityNodeRoot);
            }

            AbilityTreeNode inst = nodes[nodeId];

            inst.SetNodeThreadId(-1);
            inst.SetNodeId(nodeId);
            inst.SetCentralId(castingPlayer, centralId);

            IOnNodeInitialised oNNInst = inst as IOnNodeInitialised;

            if (oNNInst != null)
            {
                oNNInst.OnNodeInitialised();
            }

            return(inst);
        }

        return(nodes[nodeId]);
    }
コード例 #17
0
    private void onLoadHandler(LoadedData data)
    {
        Debugger.Log(data.FilePath + " LoadOver!");

        if (tobeLoadInfoQueue.Count == 0)
        {
            //if (showProgress)
            //{
            //    UI_View.UpdateProgress(totalCount);
            //    UI_View.Show(false);
            //}
            if (curLoadInfo != null && curLoadInfo.OnLoadHandler != null)
            {
                curLoadInfo.OnLoadHandler(data);
                curLoadInfo = null;
            }

            if (completeHandler != null)
            {
                completeHandler();
                Debugger.Log("Load Complete!");
            }
        }
        else
        {
            //if (showProgress)
            //{
            //    UI_View.UpdateProgress(totalCount - tobeLoadInfoQueue.Count);
            //}

            //调用一下外部的回调;
            if (curLoadInfo != null && curLoadInfo.OnLoadHandler != null)
            {
                curLoadInfo.OnLoadHandler(data);
            }

            //继续加载下一个;
            curLoadInfo = tobeLoadInfoQueue.Dequeue();
            ioo.resourceManager.LoadRes(curLoadInfo.Path, onLoadHandler);
        }
    }
コード例 #18
0
    public override void NodeCallback()
    {
        base.NodeCallback();

        if (GetNodeVariable <bool>("Internal Input Track"))
        {
            TriggerInput();
        }

        if (IsClientPlayerUpdate())
        {
            if (!inputSet)
            {
                //Debug.Log("Input Key Set: " + GetNodeVariable<int>("Input Key"));
                LoadedData.GetSingleton <PlayerInput>().AddNewInput <int>(this, 0, (KeyCode)GetNodeVariable <int>("Input Key"), InputPressType.HOLD);
            }

            //Debug.Log("Input set for " + name);
            inputSet = true;
        }
    }
コード例 #19
0
        public void LoadFromStream(TextReader stream)
        {
            _hasEverBeenReloaded = true;
            var yaml = new YamlStream();

            yaml.Load(stream);

            for (int i = 0; i < yaml.Documents.Count; i++)
            {
                try
                {
                    LoadFromDocument(yaml.Documents[i]);
                }
                catch (Exception e)
                {
                    throw new PrototypeLoadException(string.Format("Failed to load prototypes from document#{0}", i), e);
                }
            }

            LoadedData?.Invoke(yaml, "anonymous prototypes YAML stream");
        }
コード例 #20
0
 private async Task OnConvertData()
 {
     if (!string.IsNullOrEmpty(FileContent))
     {
         _status += $"{Environment.NewLine}Parsing text to logs...";
         try
         {
             LoadedData.AddRange(await ConvertJsonToSiteLogs(FileContent));
             _status += $"{Environment.NewLine}Parsed data into  {LoadedData.Count} site logs. ";
         }
         catch (Exception ex)
         {
             _status += $"{Environment.NewLine}Unable to convert file content:";
             _status += ex.Message;
         }
     }
     else
     {
         _status += "There is no text loaded.";
     }
     StateHasChanged();
 }
コード例 #21
0
    public void AssignInputKeys()
    {
        if (aData.ContainsKey(ClientProgram.clientId))
        {
            foreach (var ability in aData[ClientProgram.clientId].abilties)
            {
                if (!aData[ClientProgram.clientId].abilityManifest.ContainsValue(ability.Key))
                {
                    int keyAssigned = aData[ClientProgram.clientId].abilties[ability.Key].abilityInfo.kC;
                    LoadedData.GetSingleton <PlayerInput>().AddNewInput(aData[ClientProgram.clientId].abilties[ability.Key],0,(KeyCode)keyAssigned,0,true);

                    SpawnerOutput abilityButton = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(ButtonWrapper));
                    LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Text>(abilityButton,"Text").text = aData[ClientProgram.clientId].abilties[ability.Key].abilityInfo.n;
                    (abilities.script as LinearLayout).Add(abilityButton.script.transform as RectTransform);

                    LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Button>(abilityButton).onClick.AddListener(() => {
                        aData[ClientProgram.clientId].abilties[ability.Key].InputCallback(0);
                    });
                }
            }
        }
    }
コード例 #22
0
        public ItemsPage()
        {
            InitializeComponent();

            LoadedData.CreateCategories();

            LoadedData.LoadBrands();

            LoadedData.LoadVehicles();

            LoadedData.LoadUserVehicleData();

            carsList.FlowItemsSource = LoadedData.Vehicles;

            // Set the HasBeenPurchased variable for every vehicle.
            foreach (VehicleItem vehicleItem in LoadedData.VehicleItems)
            {
                Vehicle vehicle = LoadedData.Vehicles.Find(vehicleToGet => vehicleToGet.Id == vehicleItem.Id);

                vehicle.HasBeenPurchased = vehicleItem.HasBeenPurchased;
            }
        }
コード例 #23
0
    void Start()
    {
        mPos          = new Vector2();
        rcs           = 16;
        dimensions    = 450;
        PNGDimensions = 1024;

        CalibrateEditor();

        SpawnerOutput sO = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(ButtonWrapper));

        LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Button>(sO).onClick.AddListener(SavePNG);
        LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Text>(sO, "Text").text = "Save Art";

        SpawnerOutput nO = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(InputFieldWrapper));

        LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <InputField>(nO).onValueChanged.AddListener((s) => {
            name = s;
        });

        sO.script.transform.position = UIDrawer.UINormalisedPosition(new Vector3(0.1f, 0.9f));
        nO.script.transform.position = UIDrawer.UINormalisedPosition(new Vector3(0.1f, 0.8f));

        GeneratePixels();
        pointer = CreatePixel();


        /*colors = new Color[1000];
         * for (int i = 0; i < colors.Length; i++)
         *  if (i < 500)
         *      colors[i] = Color.red;
         *  else
         *      colors[i] = Color.black;
         *
         * colorTest = new Texture2D(100, 10);
         * colorTest.SetPixels(colors);
         *
         * File.WriteAllBytes(Application.dataPath + "/../test6.png", colorTest.EncodeToPNG());*/
    }
コード例 #24
0
    /*public void SetTimerEventID(int id) {
     *  timerEventId = id;
     * }*/

    public void AddVariableNetworkData(params AbilityNodeNetworkData[] aNND)
    {
        //Debug.Log("Variable Data added.");

        /*if(timerEventId > -1) {
         *  //Debug.Log("Timer extended.");
         *  LoadedData.GetSingleton<Timer>().UpdateEventStartTime(timerEventId, Time.realtimeSinceStartup);
         * } else {
         *  //Debug.Log("New timer added.");
         *  timerEventId = LoadedData.GetSingleton<Timer>().CreateNewTimerEvent(0.05f, this);
         *  networkNodeData.Add(timerEventId, new List<AbilityNodeNetworkData>());
         * }*/

        if (!markPending)
        {
            markPending = true;
            LoadedData.GetSingleton <AbilityNetworkDataCompiler>().pendingData.Add(this);
        }


        //Debug.LogFormat("Central {0},{1} variable added..", castingPlayer, centralId);
        networkNodeData.AddRange(aNND);
    }
コード例 #25
0
    public override void OnSpawn()
    {
        if (inputField == null)
        {
            inputField = GetComponent <InputField>();
        }

        inputField.textComponent = null;
        inputField.text          = "";
        inputField.onEndEdit.RemoveAllListeners();

        image = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(Image)).script as Image;
        text  = (LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(TextWrapper)).script as TextWrapper).scriptsData[0].script as Text;

        inputField.gameObject.SetActive(true);

        inputField.textComponent = text;
        inputField.targetGraphic = image;
        (inputField.transform as RectTransform).sizeDelta = new Vector2(100, 30);

        text.color           = Color.black;
        text.supportRichText = false;

        text.rectTransform.sizeDelta  = new Vector2(100, 30);
        image.rectTransform.sizeDelta = new Vector2(100, 30);

        image.transform.SetParent(transform);
        text.transform.SetParent(transform);
        //AllignWrapperElements();

        scriptsData = new AdditionalScriptData[] {
            new AdditionalScriptData("InputField", inputField),
            new AdditionalScriptData("Image", image),
            new AdditionalScriptData("Text", text)
        };
    }
コード例 #26
0
    void CreateLines(Transform[] points, int id)
    {
        // Creates the graphical strings.
        SpawnerOutput lGraphic = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(ButtonWrapper));

        LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Image>(lGraphic, "Image").rectTransform.pivot = new Vector2(0.5f, 0);
        LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Text>(lGraphic, "Text").text = "";

        // Adds event for changing of button colors
        LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Button>(lGraphic).onClick.AddListener(() => {
            switch (mMode)
            {
            case MouseMode.EDIT_CONN:
                int[] linkData = abilityData.linkAddresses.l[id];

                if (!LoadedData.GetVariableType(abilityData.subclasses.l[linkData[0]].classType, linkData[1], VariableTypes.PERMENANT_TYPE))
                {
                    linkData[4] = (int)lMode;
                    UpdateLineColor(id);
                    mMode = MouseMode.NONE;
                }
                break;

            case MouseMode.REMOVE_CONN:
                RemoveLine(id);
                mMode = MouseMode.NONE;
                break;
            }
        });

        LineData line = new LineData(points[0], points[1], lGraphic);

        lineData.ModifyElementAt(id, line);
        UpdateLineColor(id);
        UpdateLines(id);
    }
コード例 #27
0
    SpawnerOutput CreateVariableButtons(ActionType aT, int[] id)
    {
        SpawnerOutput linkageButton = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(ButtonWrapper));

        LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Text>(linkageButton, "Text").text = "";
        UIDrawer.ChangeUISize(linkageButton, new Vector2(20, 20));

        switch (aT)
        {
        case ActionType.RECIEVE:
            LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Button>(linkageButton).onClick.AddListener(() => {
                CreateLinkage(id);
            });
            break;

        case ActionType.SEND:
            LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Button>(linkageButton).onClick.AddListener(() => {
                prevPath = id;
            });
            break;
        }

        return(linkageButton);
    }
コード例 #28
0
    public override SpawnerOutput ReturnCustomUI(int variable, RuntimeParameters rp)
    {
        int aN = GetVariableId("Ability Name");

        if (variable == aN)
        {
            SpawnerOutput aNField          = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(DropdownWrapper));
            Dropdown      dW               = LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Dropdown>(aNField);
            List <Dropdown.OptionData> dOd = new List <Dropdown.OptionData>();
            RuntimeParameters <string> rpS = rp as RuntimeParameters <string>;
            int selected = 0;

            foreach (var kPV in AbilityPageScript.abilityInfo)
            {
                dOd.Add(new Dropdown.OptionData(kPV.Value.n));

                if (kPV.Key == rpS.v)
                {
                    selected = dOd.Count - 1;
                }
            }

            dW.AddOptions(dOd);

            dW.value = selected;

            dW.onValueChanged.AddListener((id) => {
                string[] dirNames = AbilityPageScript.abilityInfo.Keys.ToArray();
                rpS.v             = dirNames[id];
            });

            return(aNField);
        }

        return(base.ReturnCustomUI(variable, rp));
    }
コード例 #29
0
    public override void OnSpawn()
    {
        if (windowsGraphic == null)
        {
            windowsGraphic = GetComponent <Image>();
        }

        deleteButton = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(ButtonWrapper)).script as ButtonWrapper;
        content      = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(UIMule)).script as UIMule;
        windowsText  = (LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(TextWrapper)).script as TextWrapper).text;

        deleteButton.ChangeButtonSize(new Vector2(15, 15));
        deleteButton.image.color = Color.red;
        deleteButton.text.text   = "";
        windowsGraphic.color     = new Color(1, 1, 1, 0.5f);

        ChangeWindowsHeaderSize(new Vector4(25, 6, 6, 6));
        ChangeWindowsContentSize(new Vector2(100, 100));

        deleteButton.transform.SetParent(transform);
        content.transform.SetParent(transform);
        windowsText.transform.SetParent(transform);
        content.GetRectTransform().sizeDelta = new Vector2();

        deleteButton.button.onClick.RemoveAllListeners();
        deleteButton.button.onClick.AddListener(() => { gameObject.SetActive(false); });

        scriptsData = new AdditionalScriptData[] {
            new AdditionalScriptData("Windows", windowsGraphic),
            new AdditionalScriptData("DeleteButton", deleteButton),
            new AdditionalScriptData("Content", content),
            new AdditionalScriptData("WindowsText", windowsText)
        };

        transform.SetAsLastSibling();
    }
コード例 #30
0
    public override SpawnerOutput ReturnCustomUI(int variable, RuntimeParameters rp)
    {
        int o = GetVariableId("Sprite Name");

        if (o == variable)
        {
            SpawnerOutput oField           = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(DropdownWrapper));
            Dropdown      dW               = LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Dropdown>(oField);
            List <Dropdown.OptionData> dOd = new List <Dropdown.OptionData>();
            RuntimeParameters <string> rpI = rp as RuntimeParameters <string>;
            int ddId       = 0;
            var imagePaths = new DirectoryInfo(Path.Combine(LoadedData.gameDataPath, "UsrCreatedArt")).GetFiles().Where(x => x.Extension != ".meta");

            foreach (FileInfo fI in imagePaths)
            {
                if (fI.Name == rpI.v)
                {
                    ddId = dOd.Count;
                }

                dOd.Add(new Dropdown.OptionData(fI.Name));
                //Od.Add(new Dropdown.OptionData("Actual Position"));
            }

            dW.AddOptions(dOd);
            dW.value = ddId;

            dW.onValueChanged.AddListener((id) => {
                rpI.v = dOd[id].text;
            });

            return(oField);
        }

        return(base.ReturnCustomUI(variable, rp));
    }